codejump

TestClient & HTTP Assertions — Series 2

Preview — 3 of 10 questions

Which argument sends HTML form fields through a TestClient request?

Adata=
Bjson= only
Cheaders=
Dcookies=

How can a test send a cookie with one request?

ASet response.cookies before the call
BPass cookies={"session": "abc"}
CPut the cookie in response_model
DCall client.cookie() with no request

A POST route is expected to create an item. Which status should the test commonly expect?

A404 Not Found in all cases
B500 Internal Server Error
C201 Created, if that is the route contract
D304 Not Modified

Sign up free to play

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