ycdemo / fastapi / tests/ test_tutorial/ test_response_headers/ test_tutorial001.py
from fastapi.testclient import TestClient
from docs_src.response_headers.tutorial001_py310 import app
client = TestClient(app)
def test_path_operation():
response = client.get("/headers/")
assert response.status_code == 200, response.text
assert response.json() == {"message": "Hello World"}
assert response.headers["X-Cat-Dog"] == "alone in the world"
assert response.headers["Content-Language"] == "en-US"