Spaces:
Running
Running
Download backend/tests/test_api.py from abinazebinoy/verifile-x-api: direct link, hf CLI and curl.
- Browser
- Download file 659 Bytes
-
https://huggingface.co/spaces/abinazebinoy/verifile-x-api/resolve/main/backend/tests/test_api.py
- Command line
-
hf download hf://spaces/abinazebinoy/verifile-x-api/backend/tests/test_api.py
-
curl -L -o test_api.py https://huggingface.co/spaces/abinazebinoy/verifile-x-api/resolve/main/backend/tests/test_api.py
659 Bytes
| """ | |
| Tests for API endpoints. | |
| """ | |
| import pytest | |
| def test_root_endpoint(client): | |
| """Test root endpoint returns frontend HTML or API info.""" | |
| response = client.get("/") | |
| assert response.status_code == 200 | |
| # Root now serves HTML frontend, so check content type | |
| assert "text/html" in response.headers.get("content-type", "") or response.json() | |
| def test_health_check(client): | |
| """Test health check endpoint.""" | |
| response = client.get("/health") | |
| assert response.status_code == 200 | |
| data = response.json() | |
| assert data["status"] in ("healthy", "degraded") # degraded when model files absent (CI) | |
| assert "timestamp" in data | |