diff --git a/apps/vision/tests/test_app.py b/apps/vision/tests/test_app.py index 6cc69df..17f8ef0 100644 --- a/apps/vision/tests/test_app.py +++ b/apps/vision/tests/test_app.py @@ -60,8 +60,13 @@ def test_health_access_log_lines_are_dropped() -> None: access = logging.getLogger("uvicorn.access") # uvicorn's access record: '%s - "%s %s HTTP/%s" %d' with (client, method, path, version, status) fmt = '%s - "%s %s HTTP/%s" %d' - health = access.makeRecord("uvicorn.access", logging.INFO, __file__, 0, fmt, ("127.0.0.1:1", "GET", "/health", "1.1", 200), None) - analyze = access.makeRecord("uvicorn.access", logging.INFO, __file__, 0, fmt, ("127.0.0.1:1", "POST", "/analyze", "1.1", 200), None) + + def record(method: str, path: str) -> logging.LogRecord: + args = ("127.0.0.1:1", method, path, "1.1", 200) + return access.makeRecord("uvicorn.access", logging.INFO, __file__, 0, fmt, args, None) + + health = record("GET", "/health") + analyze = record("POST", "/analyze") assert flt.filter(health) is False assert flt.filter(analyze) is True # The filter is installed on the live logger at import.