Files
MobilityOps/backend/tests/test_dashboard.py
T
NuklearRabbit 03c5b60235 M1: implement operational core
Demo auth, seed import/reset, dashboard, vehicle/booking list+detail, audit trail. Backend: 19 tests passing, ruff clean. Frontend: React Router shell, typed API client, responsive pages. Verified end-to-end via curl and browser.
2026-08-01 21:20:53 +02:00

31 lines
1016 B
Python

def test_dashboard_metrics_are_persisted_counts(ops_client):
response = ops_client.get("/api/v1/dashboard")
assert response.status_code == 200
body = response.json()
metrics = body["metrics"]
total = (
metrics["available"]
+ metrics["rented"]
+ metrics["cleaning"]
+ metrics["maintenance"]
+ metrics["blocked"]
)
assert total == 50
assert metrics["open_quality_issues"] >= 1
assert metrics["pending_or_failed_workflows"] >= 1
def test_dashboard_attention_items_link_to_records(ops_client):
response = ops_client.get("/api/v1/dashboard")
body = response.json()
assert len(body["attention_items"]) > 0
for item in body["attention_items"]:
assert item["link_ref"]
assert item["severity"] in ("low", "medium", "high")
def test_dashboard_recent_automation_capped_at_five(ops_client):
response = ops_client.get("/api/v1/dashboard")
body = response.json()
assert len(body["recent_automation"]) == 5