19 lines
514 B
Python
19 lines
514 B
Python
from fastapi.testclient import TestClient
|
|
|
|
from app.main import app
|
|
|
|
client = TestClient(app)
|
|
|
|
|
|
def test_health_endpoint() -> None:
|
|
response = client.get("/api/health")
|
|
assert response.status_code in (200, 503)
|
|
body = response.json()
|
|
assert body["service"] == "desi-clans-api"
|
|
assert "database" in body
|
|
assert body["status"] in ("ok", "degraded")
|
|
|
|
if response.status_code == 200:
|
|
assert body["database"] == "connected"
|
|
else:
|
|
assert body["database"] == "unavailable"
|