Spaces:
Sleeping
Sleeping
Download test_server.py from ProthamD/api-debug-env: direct link, hf CLI and curl.
- Browser
- Download file 505 Bytes
-
https://huggingface.co/spaces/ProthamD/api-debug-env/resolve/afc1ff7772334215679f7dade7ef87affe35627f/test_server.py
- Command line
-
hf download hf://spaces/ProthamD/api-debug-env@afc1ff7772334215679f7dade7ef87affe35627f/test_server.py
-
curl -L -o test_server.py https://huggingface.co/spaces/ProthamD/api-debug-env/resolve/afc1ff7772334215679f7dade7ef87affe35627f/test_server.py
505 Bytes
| from fastapi.testclient import TestClient | |
| from server.app import app | |
| client = TestClient(app) | |
| def test_health(): | |
| response = client.get("/health") | |
| assert response.status_code == 200 | |
| print("health OK") | |
| def test_reset(): | |
| response = client.post("/reset", json={"task_id": "easy"}) | |
| assert response.status_code == 200 | |
| assert "task_description" in response.json() | |
| print("easy reset OK") | |
| if __name__ == "__main__": | |
| test_health() | |
| test_reset() | |
| print("All tests passed.") | |