Files
sales-trainer/backend/tests/test_readiness.py

21 lines
736 B
Python

"""Production readiness endpoint contract."""
from __future__ import annotations
def test_health_and_ready_are_distinct(client):
health = client.get("/health")
ready = client.get("/ready")
assert health.status_code == 200
assert health.get_json() == {"status": "ok", "service": "Sales Trainer"}
assert ready.status_code == 200
assert ready.get_json() == {"status": "ready", "checks": {"stores": "ok", "config": "ok"}}
def test_ready_never_exposes_configuration_values(app):
app.extensions["user_store"] = None
response = app.test_client().get("/ready")
assert response.status_code == 503
assert response.get_json() == {"status": "not_ready", "checks": {"stores": "failed", "config": "ok"}}