Publish curated MobilityOps source snapshot

This commit is contained in:
Jens committed 2026-09-29 22:03:33 +02:00
commit 7adc072f5e
317 files changed
+48851

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
from fastapi.testclient import TestClient
from app.main import app
def test_health() -> None:
response = TestClient(app).get("/health")
assert response.status_code == 200
assert response.json() == {"status": "ok", "service": "mobilityops-api"}
def test_liveness_is_process_only() -> None:
response = TestClient(app).get("/health/live")
assert response.status_code == 200
assert response.json()["status"] == "ok"
def test_readiness_checks_the_canonical_database() -> None:
response = TestClient(app).get("/health/ready")
assert response.status_code == 200
assert response.json() == {
"status": "ready",
"service": "mobilityops-api",
"database": "up",
}
def test_readiness_degrades_when_database_is_unavailable(monkeypatch) -> None:
import app.main as main_module
class BrokenSession:
def __enter__(self):
raise ConnectionError("database unavailable")
def __exit__(self, *_args):
return False
monkeypatch.setattr(main_module, "SessionLocal", BrokenSession)
response = TestClient(app).get("/health/ready")
assert response.status_code == 503
assert response.json()["database"] == "down"