TestClient Basics
Write synchronous FastAPI tests with TestClient — GET/POST requests, status code assertions, JSON body validation, and header checks.
Async Testing
Write async pytest tests for FastAPI using httpx.AsyncClient with a lifespan-aware test setup for database-backed endpoints.
Mocking Dependencies
Override FastAPI dependencies in tests using app.dependency_overrides to mock database sessions, auth users, and external services.