Download fastapi-backend/tests/test_api.py from APIMoral/README: direct link, hf CLI and curl.
- Browser
- Download file 399 Bytes
-
https://huggingface.co/spaces/APIMoral/README/resolve/main/fastapi-backend/tests/test_api.py
- Command line
-
hf download hf://spaces/APIMoral/README/fastapi-backend/tests/test_api.py
-
curl -L -o test_api.py https://huggingface.co/spaces/APIMoral/README/resolve/main/fastapi-backend/tests/test_api.py
399 Bytes
| import pytest | |
| from fastapi.testclient import TestClient | |
| from app.main import app | |
| client = TestClient(app) | |
| def test_root(): | |
| response = client.get("/") | |
| assert response.status_code == 200 | |
| assert response.json()["status"] == "running" | |
| def test_health_check(): | |
| response = client.get("/health") | |
| assert response.status_code == 200 | |
| assert response.json()["status"] == "healthy" | |