python-fastapi-ddd-testing-skill
Testing DDD Layers with pytest (Domain / UseCase)
This skill focuses on unit tests for the inner layers:
- Domain: Value Objects + Entities (pure business rules)
- UseCase: application workflows that orchestrate Domain + Repository interfaces
It intentionally avoids full HTTP/API tests unless explicitly requested.
Test strategy (recommended)
- Domain tests: no mocks, assert invariants and state transitions.
- UseCase tests: mock repository interfaces (
Mock(spec=...)), assert:- correct repository method calls
- correct domain exceptions raised
- correct entity state transitions
- Infrastructure/Presentation: add integration tests separately (optional).
Folder structure
More from iktakahiro/python-fastapi-ddd-skill
python-fastapi-ddd-skill
Guides FastAPI backend design using Domain-Driven Design (DDD) and Onion Architecture in Python. Use when structuring a FastAPI app (routes/handlers, Pydantic schemas, Depends-based DI), modeling domain Entities/Value Objects, defining repository interfaces, implementing SQLAlchemy infrastructure adapters, or writing use cases, based on the dddpy reference.
32python-fastapi-ddd-presentation-skill
Guides the FastAPI Presentation layer in a Python DDD + Onion Architecture app (route handler structure, Pydantic request/response schemas, mapping Domain exceptions to HTTP errors, and OpenAPI error documentation), based on the dddpy reference. Use when adding/refactoring endpoints that call UseCases and convert primitives ↔ Value Objects/Entities.
9commit
Prepare and create git commits in this repository using Conventional Commits; use when the user asks to commit or split commits for a task.
4git-flow-release
Create a release for this repository by tagging main with calendar versioning (optionally using git-flow if configured); use when the user asks to create a release or bump version.
2