prowler-cloud/prowler/prowler-test-api
- community
Checking that the SKILL.md file is still in the repository.
Testing patterns for Prowler API: JSON:API, Celery tasks, RLS isolation, RBAC. Trigger: When writing tests for api/ (JSON:API requests/assertions, cross-tenant isolation, RBAC, Celery tasks, viewsets/serializers).
Install
npx vskill@latest install prowler-cloud/prowler/prowler-test-apiSKILL.md
Critical Rules
- ALWAYS use
response.json()["data"]notresponse.data - ALWAYS use
content_type = "application/vnd.api+json"for PATCH/PUT requests - ALWAYS use
format="vnd.api+json"for POST requests - ALWAYS test cross-tenant isolation - RLS returns 404, NOT 403
- NEVER skip RLS isolation tests when adding new endpoints
- NEVER use realistic-looking API keys in tests (TruffleHog will flag them)
- ALWAYS mock BOTH
.delay()ANDTask.objects.getfor async task tests
1. Fixture Dependency Chain
Key Fixtures
| Fixture | Description | |
|---|---|---|
create_test_user | Session user (dev@prowler.com) | |
tenants_fixture | 3 tenants: [0],[1] have membership, [2] isolated | |
authenticated_client | Django test client with JWT for tenant[0] | |
authenticated_client_for_tenant_factory | Creates a Django test client with JWT for a specific user and tenant | |
provider_factory | Creates one validated provider with provider-specific defaults | |
aws_provider | 1 AWS provider in tenant[0] | |
aws_provider_pair | 2 AWS providers in tenant[0] | |
all_provider_types_fixture | 1 provider for every supported provider type | |
tasks_fixture | 2 Celery tasks with TaskResult |
RBAC Fixtures
| Fixture | Permissions | |
|---|---|---|
authenticated_client_rbac | All permissions (admin) | |
authenticated_client_rbac_noroles | Membership but NO roles | |
authenticated_client_no_permissions_rbac | All permissions = False |
Use authenticated_client for normal view behavior tests. It uses a cheap JWT and still runs the real request authentication path. Use serializer-generated JWTs or API-key clients only when the test is specifically about token obtain/refresh, invalid tokens, expired tokens, tenant switching by token, API keys, or unauthenticated 401 behavior. Use authenticated_client_for_tenant_factory when a test needs a cheap JWT client for a different user or tenant.
2. JSON:API Requests
POST (Create)
PATCH (Update)
Reading Responses
3. RLS Isolation (Cross-Tenant)
RLS returns 404, NOT 403 - the resource is invisible, not forbidden.
4. Celery Task Testing
Testing Strategies
| Strategy | Use For | |
|---|---|---|
Mock .delay() + Task.objects.get | Testing views that trigger tasks | |
task.apply() | Synchronous task logic testing | |
Mock chain/group | Testing Canvas orchestration | |
Mock connection | Testing @set_tenant decorator | |
Mock apply_async | Testing Beat scheduled tasks |
Why NOT task_always_eager
| Problem | Impact | |
|---|---|---|
| No task serialization | Misses argument type errors | |
| No broker interaction | Hides connection issues | |
| Different execution context | self.request behaves differently |
Instead, use: task.apply() for sync execution, mocking for isolation.
Full examples: See assets/api_test.py forTestCeleryTaskLogic,TestCeleryCanvas,TestSetTenantDecorator,TestBeatScheduling.
5. Fake Secrets (TruffleHog)
6. Response Status Codes
| Scenario | Code | |
|---|---|---|
| Successful GET | 200 | |
| Successful POST | 201 | |
| Async operation (DELETE/scan trigger) | 202 | |
| Sync DELETE | 204 | |
| Validation error | 400 | |
| Missing permission (RBAC) | 403 | |
| RLS isolation / not found | 404 |
Commands
Resources
- Full Examples: See assets/api_test.py for complete test patterns
- Fixture Reference: See references/test-api-docs.md
- Fixture Source:
api/src/backend/conftest.py
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/prowler-test-api/SKILL.md
Popularity
- Repository stars
- 13,378
- Repository forks
- 2,050
- 7-day trend score
- 48
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 22 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/prowler-cloud/prowler/prowler-test-api)