34 lines
978 B
Python
34 lines
978 B
Python
import main
|
|
|
|
|
|
def test_health_reports_release_and_runtime_capabilities(monkeypatch):
|
|
monkeypatch.setenv("APP_GIT_SHA", "test-sha")
|
|
monkeypatch.setenv("APP_BUILD_TIME", "2026-09-09T00:00:00Z")
|
|
monkeypatch.setattr(main, "_runtime_checks", lambda: {
|
|
"database": True,
|
|
"uploads": True,
|
|
"pdfOcr": True,
|
|
})
|
|
|
|
response = main.health()
|
|
|
|
assert response["code"] == 200
|
|
assert response["data"]["status"] == "ok"
|
|
assert response["data"]["gitSha"] == "test-sha"
|
|
assert response["data"]["buildTime"] == "2026-09-09T00:00:00Z"
|
|
assert response["data"]["checks"] == {
|
|
"database": True,
|
|
"uploads": True,
|
|
"pdfOcr": True,
|
|
}
|
|
|
|
|
|
def test_health_is_degraded_when_a_required_capability_is_missing(monkeypatch):
|
|
monkeypatch.setattr(main, "_runtime_checks", lambda: {
|
|
"database": True,
|
|
"uploads": True,
|
|
"pdfOcr": False,
|
|
})
|
|
|
|
assert main.health()["data"]["status"] == "degraded"
|