tenant-engine/tests/test_app.py

27 lines
773 B
Python
Raw Normal View History

from fastapi.testclient import TestClient
from tenant_engine.app import create_app
def test_health_endpoint() -> None:
client = TestClient(create_app())
response = client.get("/health")
assert response.status_code == 200
body = response.json()
assert body["status"] == "ok"
assert body["service"] == "tenant-engine"
assert body["store_backend"] == "memory"
def test_liveness_endpoint_does_not_depend_on_the_store() -> None:
class _UnavailableStore:
def ping(self) -> None:
raise AssertionError("liveness must not touch the store")
client = TestClient(create_app(store=_UnavailableStore()))
response = client.get("/live")
assert response.status_code == 200
assert response.json()["status"] == "ok"