codejump

TestClient & HTTP Assertions — Series 3

Preview — 3 of 10 questions

Does TestClient require starting a separate Uvicorn server for a simple route test?

ANo, it calls the ASGI app in process
BYes, every test needs a public port
CYes, it requires a deployed URL
DOnly if the response is JSON

A test sends client.delete("/items/9"). Which behavior is it checking?

AThe Python garbage collector
BThe DELETE endpoint's HTTP response
CA SQL DROP TABLE statement
DThe test file deletion

An endpoint returns a JSON list. What Python type should response.json() usually produce?

AA TestClient instance
BA SQL cursor
CA list
DA route decorator

Sign up free to play

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