(path: str, http_protocol_cls: type[HTTPProtocol], caplog: pytest.LogCaptureFixture)
| 344 | |
| 345 | @pytest.mark.parametrize(class="st">"path", [class="st">"/", class="st">"/?foo", class="st">"/?foo=bar", class="st">"/?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 = bclass="st">"\r\n".join( |
| 348 | [fclass="st">"GET {path} HTTP/1.1".encode(class="st">"ascii"), bclass="st">"Host: example.org", bclass="st">"", bclass="st">""] |
| 349 | ) |
| 350 | caplog.set_level(logging.INFO, logger=class="st">"uvicorn.access") |
| 351 | logging.getLogger(class="st">"uvicorn.access").propagate = True |
| 352 | |
| 353 | app = Response(class="st">"Hello, world", media_type=class="st">"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&class="cm">#x27;class="st">"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