Spaces:
Sleeping
Sleeping
| from __future__ import annotations | |
| import sys | |
| from pathlib import Path | |
| from fastapi.testclient import TestClient | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1])) | |
| from app.main import app | |
| def test_dynamic_endpoints_are_not_cacheable(): | |
| client = TestClient(app) | |
| response = client.get("/api/health") | |
| assert response.status_code == 200 | |
| assert response.headers["Cache-Control"] == "no-store, no-cache, must-revalidate, max-age=0" | |
| assert response.headers["Pragma"] == "no-cache" | |
| assert response.headers["Expires"] == "0" | |
| def test_root_is_not_cacheable(): | |
| client = TestClient(app) | |
| response = client.get("/") | |
| assert response.status_code == 200 | |
| assert response.headers["Cache-Control"] == "no-store, no-cache, must-revalidate, max-age=0" | |