(test_client_factory: TestClientFactory)
| 345 | |
| 346 | |
| 347 | def test_custom_on_error(test_client_factory: TestClientFactory) -> None: |
| 348 | with test_client_factory(other_app) as client: |
| 349 | response = client.get("/control-panel", auth=("tomchristie", "example")) |
| 350 | assert response.status_code == 200 |
| 351 | assert response.json() == {"authenticated": True, "user": "tomchristie"} |
| 352 | |
| 353 | response = client.get("/control-panel", headers={"Authorization": "basic foobar"}) |
| 354 | assert response.status_code == 401 |
| 355 | assert response.json() == {"error": "Invalid basic auth credentials"} |
nothing calls this directly
no test coverage detected