Kairo-Jinkendo/backend/tests/test_ap10_integration.py
Lars 09433b5d28
Some checks failed
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Failing after 1m30s
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 2s
Test Suite / compose-smoke (push) Has been skipped
AP1.2 + AP1.4: Signals konsolidieren, RoadmapItem mit Gate-Verify
Entfernt operating_phase aus dem Snapshot zugunsten von Lifecycle + signals.
Führt methodenneutrale RoadmapItems (Migration 010), Verify-Pfad und Plan-UI ein.
Milestone-API bleibt als Compat-Wrapper; Version 0.13.0-ap1.4.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-05 18:45:36 +02:00

82 lines
2.7 KiB
Python

"""AP0.10 — Integration: Snapshot, Transitions, Attention."""
from __future__ import annotations
from tests.factories import provision_user_in_tenant
from tests.test_initiatives_actions import (
_auth,
_create_action,
_create_initiative,
_login,
)
def test_steering_snapshot_graph(client):
user = provision_user_in_tenant(tenant_role="member")
token = _login(client, user)
initiative_id = _create_initiative(client, token).json()["id"]
action = _create_action(client, token, initiative_id, title="Linked Action").json()
blocker = client.post(
f"/api/initiatives/{initiative_id}/blockers",
json={"title": "B", "action_id": action["id"]},
headers=_auth(token),
)
assert blocker.status_code == 201
snap = client.get(
f"/api/initiatives/{initiative_id}/steering-snapshot",
headers=_auth(token),
)
assert snap.status_code == 200
data = snap.json()
assert isinstance(data.get("signals"), list)
assert "operating_phase" not in data
linked = next(a for a in data["actions"] if a["id"] == action["id"])
assert len(linked["blockers"]) == 1
assert linked["open_blocker_count"] == 1
def test_blocker_resolve_unblocks_action(client):
user = provision_user_in_tenant(tenant_role="member")
token = _login(client, user)
initiative_id = _create_initiative(client, token).json()["id"]
action = _create_action(client, token, initiative_id).json()["id"]
created = client.post(
f"/api/initiatives/{initiative_id}/blockers",
json={
"title": "Block",
"action_id": action,
"set_action_blocked": True,
},
headers=_auth(token),
)
blocker_id = created.json()["id"]
blocked = client.get(f"/api/actions/{action}", headers=_auth(token)).json()
assert blocked["status"] == "blocked"
client.patch(
f"/api/blockers/{blocker_id}",
json={"status": "resolved"},
headers=_auth(token),
)
unblocked = client.get(f"/api/actions/{action}", headers=_auth(token)).json()
assert unblocked["status"] == "open"
def test_attention_action_review_required_without_review(client):
user = provision_user_in_tenant(tenant_role="member")
token = _login(client, user)
initiative_id = _create_initiative(client, token).json()["id"]
action = _create_action(client, token, initiative_id).json()
client.patch(
f"/api/actions/{action['id']}",
json={"status": "review_required"},
headers=_auth(token),
)
res = client.get("/api/workspace/attention", headers=_auth(token))
assert res.status_code == 200
assert any(i["kind"] == "action_review_required" for i in res.json())