skillfed

prowler-test-sdk

This skill documents testing conventions for Prowler SDK checks and services across multiple cloud providers. It covers AWS testing with moto mocking, Azure and GCP testing with MagicMock, and establishes provider-specific patterns for fixtures, client patching, and assertion structures.

prowler-test-sdk provides testing patterns for Prowler SDK checks across AWS, Azure, GCP, and Kubernetes providers.

AI-generated summary based on this skill's SKILL.md

14,491 2,285 Apache-2.0 updated by prowler-cloud

Install

prowler-cloud/prowler/prowler-test-sdk · repository language: Python

git clone https://github.com/prowler-cloud/prowler
cp -r prowler/skills/prowler-test-sdk ~/.claude/skills/prowler-test-sdk
npx skillfed install prowler-cloud/prowler/prowler-test-sdk

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I test prowler checks?

Prowler-test-sdk provides patterns for writing unit tests for Prowler SDK checks and services. Tests use pytest fixtures to set up mocked cloud resources, with provider-specific mocking strategies: moto for AWS resource mocking, and MagicMock for Azure, GCP, and Kubernetes providers. Each test verifies check logic by asserting pass/fail/no-resource outcomes against mocked infrastructure.

What mocking approach does prowler-test-sdk use for AWS?

Prowler-test-sdk uses moto to mock AWS resources in unit tests. Moto decorators intercept boto3 calls, allowing tests to create and inspect simulated AWS infrastructure without hitting real APIs. This enables deterministic testing of Prowler checks against controlled resource states and configurations.

How does prowler-test-sdk handle Azure and GCP testing?

Prowler-test-sdk uses MagicMock to mock Azure and GCP providers, along with Kubernetes. MagicMock patches client methods and responses, allowing tests to simulate provider-specific behaviors without external dependencies. This approach provides flexibility for mocking complex cloud provider APIs and custom resource structures.

What is the prowler-test-sdk test file structure?

Prowler-test-sdk establishes conventions for test file organization, including fixture definitions for client setup, resource initialization, and check invocation. Tests follow a consistent structure: arrange mocked resources, execute the check, and assert expected pass/fail/no-resource outcomes. Fixtures enable reusable test components across multiple check tests.

How does prowler-test-sdk verify compliance check scenarios?

Prowler-test-sdk tests verify three core scenarios: pass (compliant resources), fail (non-compliant resources), and no-resource (when no resources exist). Each scenario uses mocked provider clients to simulate conditions, then asserts that the check produces correct findings with appropriate status codes and metadata.

What are prowler-test-sdk provider mocking patterns?

Prowler-test-sdk documents provider-specific mocking patterns: AWS uses moto decorators for resource lifecycle simulation; Azure, GCP, and Kubernetes use MagicMock for client patching and response mocking. Each pattern establishes how to configure clients, inject mock data, and verify check behavior against provider-specific API contracts.

SKILL.md

rendered from the published skill — quoted content, verbatim

> Generic Patterns: For base pytest patterns (fixtures, mocking, parametrize, markers), see the pytest skill. > This skill covers Prowler-specific conventions only. > > Full Documentation: docs/developer-guide/unit-testing.mdx

CRITICAL: Provider-Specific Testing

Provider Mocking Approach Decorator
AWS moto library @mock_aws
Azure, GCP, K8s, others MagicMock None

NEVER use moto for non-AWS providers. NEVER use MagicMock for AWS.


AWS Check Test Pattern

```python from unittest import mock from boto3 import client from moto import mock_aws from tests.providers.aws.utils import

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 5 files
skills/prowler-test-sdk/SKILL.md
skills/prowler-test-sdk/assets/aws_test.py
skills/prowler-test-sdk/assets/azure_test.py
skills/prowler-test-sdk/assets/gcp_test.py
skills/prowler-test-sdk/references/testing-docs.md

Related skills

Tags

unit-testing-framework cloud-provider-mocking compliance-check-validation multi-cloud-testing infrastructure-as-code-testing