Download tests/test_app.py from Atomio/facerecog: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/spaces/Atomio/facerecog/resolve/main/tests/test_app.py
- Command line
-
hf download hf://spaces/Atomio/facerecog/tests/test_app.py
-
curl -L -o test_app.py https://huggingface.co/spaces/Atomio/facerecog/resolve/main/tests/test_app.py
1 kB
| """Tests for the main FastAPI application.""" | |
| from fastapi.testclient import TestClient | |
| from app import app | |
| client = TestClient(app) | |
| def test_root_endpoint(): | |
| """Test the root endpoint.""" | |
| response = client.get("/") | |
| assert response.status_code == 200 | |
| data = response.json() | |
| assert data["status"] == "healthy" | |
| assert "timestamp" in data | |
| assert "version" in data | |
| assert "environment" in data | |
| def test_health_endpoint(): | |
| """Test the health check endpoint.""" | |
| response = client.get("/health") | |
| assert response.status_code == 200 | |
| data = response.json() | |
| assert "status" in data | |
| assert data["status"] in ["healthy", "degraded", "unhealthy"] | |
| assert "timestamp" in data | |
| assert "version" in data | |
| assert "environment" in data | |
| def test_faces_root_endpoint(): | |
| """Test the faces root endpoint.""" | |
| response = client.get("/api/v1/faces/") | |
| assert response.status_code == 200 | |
| data = response.json() | |
| assert "message" in data | |