Some checks failed
Deploy Development / deploy (push) Failing after 37s
Test Suite / pytest-backend (push) Successful in 1m41s
Test Suite / lint-backend (push) Successful in 1s
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 13s
Backlog, Actions, Projects und Tasks koennen Gates zugeordnet werden; Gate-Beitragsliste und chronologische Journey machen Plan/Ist nachvollziehbar. Co-authored-by: Cursor <cursoragent@cursor.com>
95 lines
3.0 KiB
Python
95 lines
3.0 KiB
Python
"""AP1.6 — Plan/Ist-Verknüpfung und Journey."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from tests.factories import provision_user_in_tenant
|
|
from tests.test_initiatives_actions import (
|
|
_auth,
|
|
_create_initiative,
|
|
_login,
|
|
)
|
|
|
|
|
|
def _create_gate(client, token, initiative_id, title="Gate A"):
|
|
item = client.post(
|
|
f"/api/initiatives/{initiative_id}/roadmap/items",
|
|
json={"title": title, "item_type": "milestone"},
|
|
headers=_auth(token),
|
|
)
|
|
assert item.status_code == 201
|
|
return item.json()
|
|
|
|
|
|
def test_backlog_and_action_gate_link(client):
|
|
user = provision_user_in_tenant(tenant_role="member")
|
|
token = _login(client, user)
|
|
initiative_id = _create_initiative(client, token).json()["id"]
|
|
gate = _create_gate(client, token, initiative_id)
|
|
|
|
backlog = client.post(
|
|
f"/api/initiatives/{initiative_id}/backlog",
|
|
json={"title": "Idee", "roadmap_item_id": gate["id"]},
|
|
headers=_auth(token),
|
|
)
|
|
assert backlog.status_code == 201
|
|
assert backlog.json()["roadmap_item_id"] == gate["id"]
|
|
|
|
action = client.post(
|
|
f"/api/initiatives/{initiative_id}/actions",
|
|
json={"title": "Arbeit", "roadmap_item_id": gate["id"]},
|
|
headers=_auth(token),
|
|
)
|
|
assert action.status_code == 201
|
|
assert action.json()["roadmap_item_id"] == gate["id"]
|
|
|
|
|
|
def test_convert_backlog_keeps_gate_link(client):
|
|
user = provision_user_in_tenant(tenant_role="member")
|
|
token = _login(client, user)
|
|
initiative_id = _create_initiative(client, token).json()["id"]
|
|
gate = _create_gate(client, token, initiative_id)
|
|
|
|
backlog = client.post(
|
|
f"/api/initiatives/{initiative_id}/backlog",
|
|
json={"title": "Commit me", "status": "accepted", "roadmap_item_id": gate["id"]},
|
|
headers=_auth(token),
|
|
).json()
|
|
|
|
converted = client.post(
|
|
f"/api/backlog/{backlog['id']}/convert-to-action",
|
|
json={},
|
|
headers=_auth(token),
|
|
)
|
|
assert converted.status_code == 201
|
|
assert converted.json()["action"]["roadmap_item_id"] == gate["id"]
|
|
|
|
|
|
def test_gate_contributions_and_journey(client):
|
|
user = provision_user_in_tenant(tenant_role="member")
|
|
token = _login(client, user)
|
|
initiative_id = _create_initiative(client, token).json()["id"]
|
|
gate = _create_gate(client, token, initiative_id)
|
|
|
|
client.post(
|
|
f"/api/initiatives/{initiative_id}/actions",
|
|
json={"title": "Linked work", "roadmap_item_id": gate["id"]},
|
|
headers=_auth(token),
|
|
)
|
|
|
|
contributions = client.get(
|
|
f"/api/roadmap-items/{gate['id']}/contributions",
|
|
headers=_auth(token),
|
|
)
|
|
assert contributions.status_code == 200
|
|
body = contributions.json()
|
|
assert body["counts"]["actions"] == 1
|
|
assert body["counts"]["total"] == 1
|
|
|
|
journey = client.get(
|
|
f"/api/initiatives/{initiative_id}/journey",
|
|
headers=_auth(token),
|
|
)
|
|
assert journey.status_code == 200
|
|
kinds = {e["kind"] for e in journey.json()["events"]}
|
|
assert "action" in kinds
|