All quizzesMedium
Overrides & Test Isolation — Series 2
Preview — 3 of 10 questions
A test registers app.dependency_overrides[other_get_user] = fake_user, but the route still calls get_user. Why?
AThe override key must be the callable used by the route dependency
BOverrides work only for POST routes
CThe fake must be named get_user
DTestClient ignores all dependency overrides
A test uses a fake mailer that records messages. What should it assert after the endpoint request?
AThe real SMTP server received the message
BThe expected recipient and content were recorded
CThe database engine was recreated
DEvery route returned 200
Why should an integration test for a database route use a test database connection?
AIt makes SQL syntax irrelevant
BIt disables all FastAPI dependencies
CIt protects production data and gives the test controlled state
DIt guarantees every query is fast
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.