31 lines
814 B
Python
31 lines
814 B
Python
from __future__ import annotations
|
|
|
|
from conftest import needs_db
|
|
|
|
|
|
def test_health_answers_even_without_a_database(client):
|
|
"""The WebUI banner must be able to render a degraded system."""
|
|
r = client.get("/api/v1/health")
|
|
assert r.status_code == 200
|
|
body = r.json()
|
|
assert body["status"] in {"ok", "degraded"}
|
|
assert "database" in body
|
|
assert "disk" in body
|
|
assert body["version"]
|
|
|
|
|
|
@needs_db
|
|
def test_health_is_ok_with_a_database(client):
|
|
body = client.get("/api/v1/health").json()
|
|
assert body["status"] == "ok"
|
|
assert body["database"]["ok"] is True
|
|
|
|
|
|
@needs_db
|
|
def test_healthz_is_200_when_the_database_is_up(client):
|
|
assert client.get("/healthz").status_code == 200
|
|
|
|
|
|
def test_openapi_is_served(client):
|
|
assert client.get("/openapi.json").status_code == 200
|