Some checks failed
Deploy Development / deploy (push) Successful in 52s
Test Suite / pytest-backend (push) Failing after 5m3s
Test Suite / k6 /api/health Baseline (push) Has been skipped
Test Suite / playwright-smoke (push) Has been skipped
Test Suite / lint-backend (push) Successful in 3s
Test Suite / compose-smoke (push) Has been skipped
join_gate, strand_project_id, Join-Auto-Schalten, multi-active Gates, Progression-Demo und PO-Lock-Spec. FE: Today strang-gruppiert, Join-Warteliste in Kontrolle. Co-authored-by: Cursor <cursoragent@cursor.com>
112 lines
3.5 KiB
Python
112 lines
3.5 KiB
Python
"""AP-A1-PM — progression join graph tests."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from tests.factories import provision_user_in_tenant
|
|
from tests.test_initiatives_actions import _auth, _create_initiative, _login
|
|
|
|
|
|
def test_progression_join_switches_and_activates_outputs(client):
|
|
user = provision_user_in_tenant(tenant_role="admin")
|
|
token = _login(client, user)
|
|
|
|
created = _create_initiative(
|
|
client,
|
|
token,
|
|
title="Mawashi Progression",
|
|
archetype_key="initiative.maturity_journey",
|
|
)
|
|
initiative_id = created.json()["id"]
|
|
|
|
from services.archetype_starter_kit import apply_a1_progression_demo
|
|
|
|
demo = apply_a1_progression_demo(
|
|
tenant_id=user["tenant_id"],
|
|
initiative_id=initiative_id,
|
|
user_id=user["id"],
|
|
)
|
|
assert demo["applied"] is True
|
|
|
|
progression = client.get(
|
|
f"/api/initiatives/{initiative_id}/roadmap/progression-state",
|
|
headers=_auth(token),
|
|
)
|
|
assert progression.status_code == 200
|
|
body = progression.json()
|
|
assert len(body["active_work_gates"]) == 2
|
|
assert len(body["joins"]) == 1
|
|
assert body["joins"][0]["pending_inputs"]
|
|
|
|
items = client.get(
|
|
f"/api/initiatives/{initiative_id}/roadmap/items",
|
|
headers=_auth(token),
|
|
).json()
|
|
by_title = {item["title"]: item for item in items}
|
|
d1 = by_title["Dehnung — Einstieg"]
|
|
h1 = by_title["Hüftrotation — Einstieg"]
|
|
join = by_title["Mawashi Geri zur Hüfte"]
|
|
|
|
for gate in (d1, h1):
|
|
client.post(
|
|
f"/api/initiatives/{initiative_id}/evidence",
|
|
json={
|
|
"title": f"Nachweis {gate['title']}",
|
|
"roadmap_item_id": gate["id"],
|
|
"status": "accepted",
|
|
},
|
|
headers=_auth(token),
|
|
)
|
|
verify = client.post(
|
|
f"/api/roadmap-items/{gate['id']}/verify-reached",
|
|
headers=_auth(token),
|
|
)
|
|
assert verify.status_code == 200
|
|
|
|
items_after = client.get(
|
|
f"/api/initiatives/{initiative_id}/roadmap/items",
|
|
headers=_auth(token),
|
|
).json()
|
|
by_title_after = {item["title"]: item for item in items_after}
|
|
assert by_title_after[join["title"]]["status"] == "reached"
|
|
assert by_title_after["Dehnung — nach Join"]["status"] == "active"
|
|
assert by_title_after["Hüftrotation — nach Join"]["status"] == "active"
|
|
|
|
recurring = client.get(
|
|
f"/api/initiatives/{initiative_id}/recurring",
|
|
headers=_auth(token),
|
|
).json()
|
|
active_titles = {r["title"] for r in recurring if r["status"] == "active"}
|
|
assert "Enddehnung Mawashi-Vorbereitung" in active_titles
|
|
assert "Explosive Hüftrotation" in active_titles
|
|
|
|
|
|
def test_multi_active_work_gates_both_in_next_actions(client):
|
|
user = provision_user_in_tenant(tenant_role="admin")
|
|
token = _login(client, user)
|
|
|
|
created = _create_initiative(
|
|
client,
|
|
token,
|
|
title="Multi Active",
|
|
archetype_key="initiative.maturity_journey",
|
|
)
|
|
initiative_id = created.json()["id"]
|
|
|
|
from services.archetype_starter_kit import apply_a1_progression_demo
|
|
|
|
apply_a1_progression_demo(
|
|
tenant_id=user["tenant_id"],
|
|
initiative_id=initiative_id,
|
|
user_id=user["id"],
|
|
)
|
|
|
|
snap = client.get(
|
|
f"/api/initiatives/{initiative_id}/steering-snapshot",
|
|
headers=_auth(token),
|
|
)
|
|
assert snap.status_code == 200
|
|
recurring_items = [
|
|
a for a in snap.json().get("next_actions") or [] if a.get("kind") == "recurring_due"
|
|
]
|
|
assert len(recurring_items) >= 2
|