What problem does it solve?
Writing tests for the Prowler MCP Server involves subtle pitfalls: pydantic Field defaults that only resolve through the FastMCP protocol, a ProwlerAPIClient singleton captured at import time, and JSON:API response shapes that must be built correctly. This Skill encodes the fixtures, patterns, and critical rules so tests are deterministic and never touch the real network.
Core Features & Use Cases
- In-memory tool testing: Drive MCP tools through
async with Client(mcp_root_server) so pydantic defaults resolve, and assert on structured result.data plus the recorded HTTP request.
- Mocked API layer: Use the
mock_api_client and MockRouter fixtures to register JSON:API routes, replay response sequences for polling, and inspect query parameters and paths.
- Model and contract tests: Build JSON:API documents with helper functions to test
from_api_response() parsing, and enforce namespacing and description coverage across every registered tool.
- Use Case: When adding a new findings tool under
mcp_server/, generate a tool test that registers a mocked /api/v1/findings/latest route, calls the tool through the in-memory client, and asserts both the returned payload and the translated filter query parameters.
Quick Start
Write a pytest test for the prowler_search_security_findings MCP tool using the mock_api_client and mock_router fixtures.