AP2.3a: Operating Context API mit ui_profile_json und Archetyp-Sync.
Test Suite / pytest-backend (push) Waiting to run
Test Suite / lint-backend (push) Waiting to run
Test Suite / compose-smoke (push) Waiting to run
Test Suite / k6 /api/health Baseline (push) Blocked by required conditions
Test Suite / playwright-smoke (push) Blocked by required conditions
Deploy Development / deploy (push) Has been cancelled
Test Suite / pytest-backend (push) Waiting to run
Test Suite / lint-backend (push) Waiting to run
Test Suite / compose-smoke (push) Waiting to run
Test Suite / k6 /api/health Baseline (push) Blocked by required conditions
Test Suite / playwright-smoke (push) Blocked by required conditions
Deploy Development / deploy (push) Has been cancelled
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
ad6740ffa8
commit
4ad908bfbf
7 files changed
+486
-3
No files matched your search
@@ -0,0 +1,159 @@
|
||||
"""AP2.3a — Operating Context API."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from auth import AUTH_HEADER
|
||||
from tests.factories import provision_user_in_tenant
|
||||
from tests.test_initiatives_actions import _auth, _create_initiative, _login
|
||||
|
||||
|
||||
def test_operating_context_product(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Product Alpha",
|
||||
archetype_key="initiative.product",
|
||||
)
|
||||
assert created.status_code == 201
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
res = client.get(
|
||||
f"/api/initiatives/{initiative_id}/operating-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert res.status_code == 200
|
||||
body = res.json()
|
||||
assert body["initiative_id"] == initiative_id
|
||||
assert body["archetype_key"] == "initiative.product"
|
||||
assert body["method_key"] == "continuous_product"
|
||||
assert body["ui_profile"]["planDefaultRoute"] == "/plan/inbox"
|
||||
assert body["ui_profile"]["workDefaultRoute"] == "/work/sprint"
|
||||
assert "work_cycles" in body["data_slices"]
|
||||
assert body["ui_profile"]["processSteps"]
|
||||
assert body["method_capabilities"]["next_action_strategy_key"]
|
||||
|
||||
|
||||
def test_operating_context_linear(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Linear Proj",
|
||||
archetype_key="initiative.linear_project",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
res = client.get(
|
||||
f"/api/initiatives/{initiative_id}/operating-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert res.status_code == 200
|
||||
body = res.json()
|
||||
assert body["method_key"] == "sequential_dependency"
|
||||
assert body["ui_profile"]["planDefaultRoute"] == "/plan/gates"
|
||||
assert "work_cycles" not in body["data_slices"]
|
||||
|
||||
|
||||
def test_operating_context_maturity(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Maturity",
|
||||
archetype_key="initiative.maturity_journey",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
res = client.get(
|
||||
f"/api/initiatives/{initiative_id}/operating-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert res.status_code == 200
|
||||
body = res.json()
|
||||
assert body["method_key"] == "maturity_progression"
|
||||
assert any(s["key"] == "journey" for s in body["ui_profile"]["processSteps"])
|
||||
|
||||
|
||||
def test_operating_context_program(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Program",
|
||||
archetype_key="initiative.program",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
res = client.get(
|
||||
f"/api/initiatives/{initiative_id}/operating-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert res.status_code == 200
|
||||
body = res.json()
|
||||
assert body["method_key"] == "program_delivery"
|
||||
assert body["ui_profile"]["planOutlineKeys"] is not None
|
||||
|
||||
|
||||
def test_operating_context_generic_fallback(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Dispute",
|
||||
archetype_key="initiative.dispute_case",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
res = client.get(
|
||||
f"/api/initiatives/{initiative_id}/operating-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert res.status_code == 200
|
||||
body = res.json()
|
||||
assert body["ui_profile"]["planDefaultRoute"] == "/plan/profile"
|
||||
assert body["ui_profile"]["processSteps"] == []
|
||||
|
||||
|
||||
def test_operating_context_support_queue_no_work_cycles(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
created = _create_initiative(
|
||||
client,
|
||||
token,
|
||||
title="Support Queue",
|
||||
archetype_key="initiative.support_queue",
|
||||
)
|
||||
initiative_id = created.json()["id"]
|
||||
|
||||
res = client.get(
|
||||
f"/api/initiatives/{initiative_id}/operating-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert res.status_code == 200
|
||||
body = res.json()
|
||||
assert body["method_key"] == "queue_pull"
|
||||
assert "work_cycles" not in body["data_slices"]
|
||||
assert "sprint" not in (body["ui_profile"].get("planOutlineKeys") or [])
|
||||
|
||||
|
||||
def test_operating_context_not_found(client):
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
res = client.get(
|
||||
"/api/initiatives/00000000-0000-0000-0000-000000000099/operating-context",
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert res.status_code == 404
|
||||
Reference in new issue
Block a user