Spaces:
Sleeping
Sleeping
Download backend/tests/test_cache_headers.py from appQQQ/Fin-EvalOps-v2: direct link, hf CLI and curl.
- Browser
- Download file 793 Bytes
-
https://huggingface.co/spaces/appQQQ/Fin-EvalOps-v2/resolve/main/backend/tests/test_cache_headers.py
- Command line
-
hf download hf://spaces/appQQQ/Fin-EvalOps-v2/backend/tests/test_cache_headers.py
-
curl -L -o test_cache_headers.py https://huggingface.co/spaces/appQQQ/Fin-EvalOps-v2/resolve/main/backend/tests/test_cache_headers.py
793 Bytes
| 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" | |