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>
69 lines
2.2 KiB
Python
69 lines
2.2 KiB
Python
"""AP2.0e — maturity stage transition on verify reached."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from tests.factories import provision_user_in_tenant
|
|
from tests.test_initiatives_actions import _auth, _login
|
|
|
|
|
|
def test_maturity_stage_reached_rotates_recurring(client):
|
|
user = provision_user_in_tenant(tenant_role="admin")
|
|
token = _login(client, user)
|
|
|
|
created = client.post(
|
|
"/api/initiatives",
|
|
json={
|
|
"title": "Spagat Test",
|
|
"archetype_key": "initiative.maturity_journey",
|
|
},
|
|
headers=_auth(token),
|
|
)
|
|
assert created.status_code == 201
|
|
initiative_id = created.json()["id"]
|
|
|
|
items = client.get(
|
|
f"/api/initiatives/{initiative_id}/roadmap/items",
|
|
headers=_auth(token),
|
|
).json()
|
|
stage1 = next(i for i in items if i["title"] == "Stufe 1 — Basis")
|
|
|
|
client.post(
|
|
f"/api/initiatives/{initiative_id}/evidence",
|
|
json={
|
|
"title": "Stufe 1 geschafft",
|
|
"roadmap_item_id": stage1["id"],
|
|
"status": "accepted",
|
|
},
|
|
headers=_auth(token),
|
|
)
|
|
|
|
verify = client.post(
|
|
f"/api/roadmap-items/{stage1['id']}/verify-reached",
|
|
headers=_auth(token),
|
|
)
|
|
assert verify.status_code == 200
|
|
body = verify.json()
|
|
assert body["status"] == "reached"
|
|
transition = body.get("maturity_transition") or {}
|
|
legacy = transition.get("legacy_linear") or {}
|
|
practice_ids = (legacy.get("practice_transition") or {}).get("practice_ids") or []
|
|
assert practice_ids or transition.get("successors_activated") or transition.get("joins_switched")
|
|
|
|
recurring = client.get(
|
|
f"/api/initiatives/{initiative_id}/recurring",
|
|
headers=_auth(token),
|
|
).json()
|
|
titles = {r["title"]: r["status"] for r in recurring}
|
|
assert titles.get("Vorbeuge-Dehnung") == "paused"
|
|
assert titles.get("Hüftöffner (Schmetterling)") == "paused"
|
|
assert any(
|
|
t.startswith("Seitlicher Spagat") and titles[t] == "active" for t in titles
|
|
)
|
|
|
|
items_after = client.get(
|
|
f"/api/initiatives/{initiative_id}/roadmap/items",
|
|
headers=_auth(token),
|
|
).json()
|
|
stage2 = next(i for i in items_after if i["title"] == "Stufe 2 — Aufbau")
|
|
assert stage2["status"] == "active"
|