Spaces:
Sleeping
Sleeping
Download tests/test_dashboard.py from Sanuka0523/Cardiac_Monitor_API: direct link, hf CLI and curl.
- Browser
- Download file 800 Bytes
-
https://huggingface.co/spaces/Sanuka0523/Cardiac_Monitor_API/resolve/main/tests/test_dashboard.py
- Command line
-
hf download hf://spaces/Sanuka0523/Cardiac_Monitor_API/tests/test_dashboard.py
-
curl -L -o test_dashboard.py https://huggingface.co/spaces/Sanuka0523/Cardiac_Monitor_API/resolve/main/tests/test_dashboard.py
800 Bytes
| from fastapi.testclient import TestClient | |
| from app.main import app | |
| # Not used as a context manager, so the lifespan (DB connect, model loading) does not run | |
| client = TestClient(app) | |
| def test_dashboard_is_served_as_html(): | |
| r = client.get("/dashboard") | |
| assert r.status_code == 200 | |
| assert r.headers["content-type"].startswith("text/html") | |
| assert "<title>Cardiac Monitor" in r.text | |
| def test_dashboard_uses_the_existing_api(): | |
| html = client.get("/dashboard").text | |
| paths = ("/api/v1/auth/login", "/api/v1/auth/register", "/api/v1/auth/me", | |
| "/api/v1/vitals/", "/api/v1/predictions/") | |
| for path in paths: | |
| assert path in html | |
| def test_dashboard_is_hidden_from_the_api_schema(): | |
| assert "/dashboard" not in client.get("/openapi.json").json()["paths"] | |