All checks were successful
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Successful in 2m57s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 20s
CriticalPathPanel aus Execution Graph, Next-Action-Begruendung und Integrationstest fuer sequential_dependency. Co-authored-by: Cursor <cursoragent@cursor.com>
79 lines
2.6 KiB
Python
79 lines
2.6 KiB
Python
"""AP2.2b — A2 linear project: critical path in execution graph + Next Action."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from tests.factories import provision_user_in_tenant
|
|
from tests.test_initiatives_actions import _auth, _create_initiative, _login
|
|
|
|
|
|
def test_linear_critical_path_and_next_action(client):
|
|
user = provision_user_in_tenant(tenant_role="admin")
|
|
token = _login(client, user)
|
|
|
|
created = _create_initiative(
|
|
client,
|
|
token,
|
|
title="Neue Küche",
|
|
archetype_key="initiative.linear_project",
|
|
)
|
|
initiative_id = created.json()["id"]
|
|
|
|
a = client.post(
|
|
f"/api/initiatives/{initiative_id}/actions",
|
|
json={"title": "Rohbau", "status": "open", "sort_order": 0},
|
|
headers=_auth(token),
|
|
)
|
|
b = client.post(
|
|
f"/api/initiatives/{initiative_id}/actions",
|
|
json={"title": "Elektrik", "status": "open", "sort_order": 1},
|
|
headers=_auth(token),
|
|
)
|
|
c = client.post(
|
|
f"/api/initiatives/{initiative_id}/actions",
|
|
json={"title": "Endabnahme", "status": "open", "sort_order": 2},
|
|
headers=_auth(token),
|
|
)
|
|
assert a.status_code == 201 and b.status_code == 201 and c.status_code == 201
|
|
a_id, b_id, c_id = a.json()["id"], b.json()["id"], c.json()["id"]
|
|
|
|
dep1 = client.post(
|
|
f"/api/initiatives/{initiative_id}/execution/dependencies",
|
|
json={
|
|
"predecessor_action_id": a_id,
|
|
"successor_action_id": b_id,
|
|
"dependency_kind": "requires",
|
|
},
|
|
headers=_auth(token),
|
|
)
|
|
dep2 = client.post(
|
|
f"/api/initiatives/{initiative_id}/execution/dependencies",
|
|
json={
|
|
"predecessor_action_id": b_id,
|
|
"successor_action_id": c_id,
|
|
"dependency_kind": "requires",
|
|
},
|
|
headers=_auth(token),
|
|
)
|
|
assert dep1.status_code == 201 and dep2.status_code == 201
|
|
|
|
graph = client.get(
|
|
f"/api/initiatives/{initiative_id}/execution/graph-state",
|
|
headers=_auth(token),
|
|
)
|
|
assert graph.status_code == 200
|
|
body = graph.json()
|
|
assert body["critical_path"] == [a_id, b_id, c_id]
|
|
assert a_id in body["ready_actions"]
|
|
assert b_id in body["blocked_actions"]
|
|
|
|
snap = client.get(
|
|
f"/api/initiatives/{initiative_id}/steering-snapshot",
|
|
headers=_auth(token),
|
|
)
|
|
assert snap.status_code == 200
|
|
next_actions = snap.json().get("next_actions") or []
|
|
assert next_actions
|
|
top = next_actions[0]
|
|
assert top.get("action_id") == a_id
|
|
assert top.get("reason_code") in ("execution_ready", "execution_critical_path")
|