tests/test_tutorial/test_response_headers/test_tutorial001.py
raw| 1 | from fastapi.testclient import TestClient |
| 2 | |
| 3 | from docs_src.response_headers.tutorial001_py310 import app |
| 4 | |
| 5 | client = TestClient(app) |
| 6 | |
| 7 | |
| 8 | def test_path_operation(): |
| 9 | response = client.get("/headers/") |
| 10 | assert response.status_code == 200, response.text |
| 11 | assert response.json() == {"message": "Hello World"} |
| 12 | assert response.headers["X-Cat-Dog"] == "alone in the world" |
| 13 | assert response.headers["Content-Language"] == "en-US" |