Kairo-Jinkendo/backend/tests/test_ap20_method_profiles.py
Lars efb45a3ee6
Some checks failed
Test Suite / pytest-backend (push) Failing after 2s
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
Deploy Development / deploy (push) Failing after 50s
Erfassen und Transparent: Archetyp, Methode und Auspraegung in der UI sichtbar.
Method-Profiles-API und Auswahl beim Anlegen/Profil; Steuerungs-Meta in Listen und Plan; Projekt-Archetyp-Spiegel, Next-Action-Links und Umlaut-Fix fuer testbare Guidance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-10 12:36:12 +02:00

74 lines
2.3 KiB
Python

"""Tests for method profile API — AP2.0 capture slice."""
from __future__ import annotations
from tests.factories import provision_user_in_tenant
from tests.test_initiatives_actions import _auth, _create_initiative, _login
def test_method_profiles_list_for_product_archetype(client):
user = provision_user_in_tenant(tenant_role="member")
token = _login(client, user)
res = client.get(
"/api/steering/method-profiles?initiative_archetype_key=initiative.product",
headers=_auth(token),
)
assert res.status_code == 200
keys = {item["key"] for item in res.json()}
assert "product.kairo_dev" in keys
def test_create_initiative_with_method_profile(client):
user = provision_user_in_tenant(tenant_role="member")
token = _login(client, user)
created = client.post(
"/api/initiatives",
json={
"title": "Kairo Dev",
"archetype_key": "initiative.product",
"method_profile_key": "product.kairo_dev",
},
headers=_auth(token),
)
assert created.status_code == 201
initiative_id = created.json()["id"]
snap = client.get(
f"/api/initiatives/{initiative_id}/steering-snapshot",
headers=_auth(token),
)
assert snap.status_code == 200
body = snap.json()
assert body["method_profile_key"] == "product.kairo_dev"
assert body.get("method_profile_label") == "Kairo Entwicklung"
assert body["method_key"] == "continuous_product"
def test_patch_method_profile_on_initiative(client):
user = provision_user_in_tenant(tenant_role="member")
token = _login(client, user)
created = _create_initiative(
client,
token,
title="Product X",
archetype_key="initiative.product",
)
initiative_id = created.json()["id"]
patched = client.patch(
f"/api/steering/initiatives/{initiative_id}/context",
json={"method_profile_key": "product.kairo_dev"},
headers=_auth(token),
)
assert patched.status_code == 200
assert patched.json()["method_key"] == "continuous_product"
snap = client.get(
f"/api/initiatives/{initiative_id}/steering-snapshot",
headers=_auth(token),
)
assert snap.json()["method_profile_label"] == "Kairo Entwicklung"