From 378f7e431c429450699cc6cb4223676fdc717feb Mon Sep 17 00:00:00 2001 From: alv2017 Date: Sat, 22 Mar 2025 03:12:13 +0200 Subject: [PATCH] tests/test_tutorial/test_middleware/test_tutorial002.py: new test added --- .../test_tutorial/test_middleware/test_tutorial002.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/test_tutorial/test_middleware/test_tutorial002.py diff --git a/tests/test_tutorial/test_middleware/test_tutorial002.py b/tests/test_tutorial/test_middleware/test_tutorial002.py new file mode 100644 index 000000000..6d8b975f0 --- /dev/null +++ b/tests/test_tutorial/test_middleware/test_tutorial002.py @@ -0,0 +1,11 @@ +from docs_src.middleware.tutorial002 import app +from fastapi.testclient import TestClient + + +def test_add_process_time_header_middleware(): + client = TestClient(app) + response = client.get("/") + assert response.status_code == 200 + assert response.json() == {"hello": "world"} + assert "X-Process-Time" in response.headers + assert len(response.headers["X-Process-Time"]) > 0