MCPcopy Create free account
hub / github.com/encode/starlette / test_user_interface

Function test_user_interface

tests/test_authentication.py:213–221  ·  view source on GitHub ↗
(test_client_factory: TestClientFactory)

Source from the content-addressed store, hash-verified

211
212
213def test_user_interface(test_client_factory: TestClientFactory) -> None:
214 with test_client_factory(app) as client:
215 response = client.get("/")
216 assert response.status_code == 200
217 assert response.json() == {"authenticated": False, "user": "", "identity": ""}
218
219 response = client.get("/", auth=("tomchristie", "example"))
220 assert response.status_code == 200
221 assert response.json() == {"authenticated": True, "user": "tomchristie", "identity": "tomchristie"}
222
223
224def test_authentication_required(test_client_factory: TestClientFactory) -> None:

Callers

nothing calls this directly

Calls 3

test_client_factoryFunction · 0.85
jsonMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected