(path: str, http_protocol_cls: type[HTTPProtocol], caplog: pytest.LogCaptureFixture)
| 344 | |
| 345 | @pytest.mark.parametrize("path", ["/", "/?foo", "/?foo=bar", "/?foo=bar&baz=1"]) |
| 346 | async def test_request_logging(path: str, http_protocol_cls: type[HTTPProtocol], caplog: pytest.LogCaptureFixture): |
| 347 | get_request_with_query_string = b"\r\n".join( |
| 348 | [f"GET {path} HTTP/1.1".encode("ascii"), b"Host: example.org", b"", b""] |
| 349 | ) |
| 350 | caplog.set_level(logging.INFO, logger="uvicorn.access") |
| 351 | logging.getLogger("uvicorn.access").propagate = True |
| 352 | |
| 353 | app = Response("Hello, world", media_type="text/plain") |
| 354 | |
| 355 | protocol = get_connected_protocol(app, http_protocol_cls, log_config=None) |
| 356 | protocol.data_received(get_request_with_query_string) |
| 357 | await protocol.loop.run_one() |
| 358 | assert f'"GET {path} HTTP/1.1" 200' in caplog.records[0].message |
| 359 | |
| 360 | |
| 361 | async def test_head_request(http_protocol_cls: type[HTTPProtocol]): |
nothing calls this directly
no test coverage detected