Browse Source

tests/test_tutorial/test_middleware/test_tutorial002.py: new test added

pull/13525/head
alv2017 2 weeks ago
parent
commit
378f7e431c
  1. 11
      tests/test_tutorial/test_middleware/test_tutorial002.py

11
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
Loading…
Cancel
Save