codejump

Async, Lifespan & Database Tests — Series 2

Preview — 3 of 10 questions

A test uses SQLite :memory: through separate connections and sees missing tables. What should its fixture ensure?

AThe requests and setup share the intended in-memory database connection or pool
BThe test sets response status to 201
CThe client sends every request twice
DThe table model is hidden from OpenAPI

A database test fixture begins an outer transaction and rolls it back after a route test. What is the purpose?

AMake the endpoint return 404 automatically
BDiscard changes made during the test while keeping a controlled starting state
CPrevent any SQL from executing
DSkip response validation

A route calls a database session provider, but a test only creates tables in a test database without overriding the provider. What is the risk?

ATable creation automatically rewires all dependencies
BTestClient cannot call database routes
CThe route may still connect to the application's normal database
DPytest converts SQL to JSON

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.