Browse Source

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

pull/13525/head
alv2017 2 weeks ago
parent
commit
dcda941256
  1. 0
      tests/test_tutorial/test_middleware/__init__.py
  2. 12
      tests/test_tutorial/test_middleware/test_tutorial001.py

0
tests/test_tutorial/test_middleware/__init__.py

12
tests/test_tutorial/test_middleware/test_tutorial001.py

@ -0,0 +1,12 @@
from docs_src.middleware.tutorial001 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