Spaces:
Sleeping
Sleeping
File size: 800 Bytes
c255149 f394214 c255149 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 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"]
|