From dd343f2a5b27735b6c4e76e44cd71d0be00cf17b Mon Sep 17 00:00:00 2001 From: alv2017 Date: Sat, 22 Mar 2025 13:30:19 +0200 Subject: [PATCH] tests/test_tutorial/test_middleware/: tests updated: new assertion added --- tests/test_tutorial/test_middleware/test_tutorial001.py | 5 +++++ tests/test_tutorial/test_middleware/test_tutorial002.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/tests/test_tutorial/test_middleware/test_tutorial001.py b/tests/test_tutorial/test_middleware/test_tutorial001.py index ec7f7ac3d..548937924 100644 --- a/tests/test_tutorial/test_middleware/test_tutorial001.py +++ b/tests/test_tutorial/test_middleware/test_tutorial001.py @@ -10,3 +10,8 @@ def test_add_process_time_header_middleware(): assert response.json() == {"hello": "world"} assert "X-Process-Time" in response.headers assert len(response.headers["X-Process-Time"]) > 0 + + # request/response process time + process_time = response.headers["X-Process-Time"] + assert float(process_time) > 0 + diff --git a/tests/test_tutorial/test_middleware/test_tutorial002.py b/tests/test_tutorial/test_middleware/test_tutorial002.py index 3eaa8049c..43b2c1121 100644 --- a/tests/test_tutorial/test_middleware/test_tutorial002.py +++ b/tests/test_tutorial/test_middleware/test_tutorial002.py @@ -10,3 +10,6 @@ def test_add_process_time_header_middleware(): assert response.json() == {"hello": "world"} assert "X-Process-Time" in response.headers assert len(response.headers["X-Process-Time"]) > 0 + # request/response process time + process_time = response.headers["X-Process-Time"] + assert float(process_time) > 0