Files
MobilityOps/backend/tests/test_demo_manifest.py
T
NuklearRabbit ac427f4427 feat(demo): add demo manifest, Dutch demo entry, permanent badge and About page
Adds GET /api/v1/demo/manifest as a single source of truth for the demo's
fictional org identity (Northstar Mobility -- surfacing the project's
already-locked tenant name), synthetic-data/reset state, and live scenario
readiness. Rewrites the login screen in Dutch with an honest, no-password
demo entry and a guided-demo entry point, replaces the loud full-width
demo banner with a subtle badge + popover, and adds a compact About page
explaining what's real vs. synthetic vs. not yet connected.
2026-08-03 13:45:55 +02:00

56 lines
2.0 KiB
Python

from app.core.db import SessionLocal
from app.seed_loader import reset_and_seed
def test_demo_manifest_is_public(client):
# No login call at all -- the demo-entry screen and badge need this before any
# session exists.
response = client.get("/api/v1/demo/manifest")
assert response.status_code == 200
def test_demo_manifest_shape(client):
body = client.get("/api/v1/demo/manifest").json()
assert body["organization_name"] == "Northstar Mobility"
assert body["demo_mode"] is True
assert body["synthetic_data"] is True
assert body["allow_reset"] is True
assert body["timezone"] == "Europe/Brussels"
assert body["guide_available"] is True
assert set(body["required_roles"]) == {"operations_manager", "rental_employee"}
assert body["last_reset_at"] is not None
assert body["anchor_date"] is not None
scenario_ids = {s["id"] for s in body["scenarios"]}
assert scenario_ids == {
"return-anomaly",
"duplicate-customer",
"booking-overlap",
"automation-retry",
"knowledge-question",
}
integration_keys = {i["key"] for i in body["integrations"]}
assert integration_keys == {"n8n", "ragcore", "mcp_hub"}
def test_demo_manifest_scenarios_ready_after_fresh_reset(client):
db = SessionLocal()
try:
reset_and_seed(db)
finally:
db.close()
body = client.get("/api/v1/demo/manifest").json()
scenarios = {s["id"]: s for s in body["scenarios"]}
for scenario_id, scenario in scenarios.items():
assert scenario["ready"] is True, f"{scenario_id} should be ready right after a reset"
assert scenario["blocked_reason"] is None
assert scenario["start_path"]
def test_demo_manifest_ragcore_labelled_as_demo_mode_not_live(client):
body = client.get("/api/v1/demo/manifest").json()
ragcore = next(i for i in body["integrations"] if i["key"] == "ragcore")
assert "Demomodus" in ragcore["status_label"]
assert "RAGcore" not in ragcore["status_label"]