All checks were successful
Deploy Development / deploy (push) Successful in 50s
Test Suite / pytest-backend (push) Successful in 4m54s
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 19s
Test Suite / playwright-smoke (push) Successful in 13s
Gate-Detail: Übungen anlegen mit Rhythmus, Gate aktivieren, Link zu Today. API: /roadmap-items/{id}/practices und roadmap_item_id auf Recurring-Create. Damit ist A1 ohne Starter-Kit manuell durchspielbar.
Co-authored-by: Cursor <cursoragent@cursor.com>
95 lines
2.6 KiB
Python
95 lines
2.6 KiB
Python
"""Gate Activity Set API — A1 minimal usability."""
|
||
|
||
from __future__ import annotations
|
||
|
||
from tests.factories import provision_user_in_tenant
|
||
from tests.test_initiatives_actions import _auth, _create_initiative, _login
|
||
|
||
|
||
def test_gate_practice_create_and_list(client):
|
||
user = provision_user_in_tenant(tenant_role="admin")
|
||
token = _login(client, user)
|
||
|
||
created = _create_initiative(
|
||
client,
|
||
token,
|
||
title="A1 Gate Practices",
|
||
archetype_key="initiative.maturity_journey",
|
||
apply_starter_kit=False,
|
||
)
|
||
initiative_id = created.json()["id"]
|
||
|
||
gate = client.post(
|
||
f"/api/initiatives/{initiative_id}/roadmap/items",
|
||
json={
|
||
"title": "Dehnung — Einstieg",
|
||
"item_type": "maturity_stage",
|
||
"status": "active",
|
||
},
|
||
headers=_auth(token),
|
||
)
|
||
assert gate.status_code == 201
|
||
gate_id = gate.json()["id"]
|
||
|
||
empty = client.get(
|
||
f"/api/roadmap-items/{gate_id}/practices",
|
||
headers=_auth(token),
|
||
)
|
||
assert empty.status_code == 200
|
||
assert empty.json() == []
|
||
|
||
created_practice = client.post(
|
||
f"/api/roadmap-items/{gate_id}/practices",
|
||
json={
|
||
"title": "Vorbeuge halten",
|
||
"description": "3×30 Sek.",
|
||
"interval_days": 1,
|
||
},
|
||
headers=_auth(token),
|
||
)
|
||
assert created_practice.status_code == 201
|
||
body = created_practice.json()
|
||
assert body["roadmap_item_id"] == gate_id
|
||
assert body["interval_days"] == 1
|
||
|
||
listed = client.get(
|
||
f"/api/roadmap-items/{gate_id}/practices",
|
||
headers=_auth(token),
|
||
)
|
||
assert listed.status_code == 200
|
||
assert len(listed.json()) == 1
|
||
assert listed.json()[0]["title"] == "Vorbeuge halten"
|
||
|
||
|
||
def test_join_gate_rejects_practices(client):
|
||
user = provision_user_in_tenant(tenant_role="admin")
|
||
token = _login(client, user)
|
||
|
||
created = _create_initiative(
|
||
client,
|
||
token,
|
||
title="Join no practices",
|
||
archetype_key="initiative.maturity_journey",
|
||
apply_starter_kit=False,
|
||
)
|
||
initiative_id = created.json()["id"]
|
||
|
||
join = client.post(
|
||
f"/api/initiatives/{initiative_id}/roadmap/items",
|
||
json={
|
||
"title": "Konsolidierung",
|
||
"item_type": "join_gate",
|
||
"status": "planned",
|
||
},
|
||
headers=_auth(token),
|
||
)
|
||
assert join.status_code == 201
|
||
join_id = join.json()["id"]
|
||
|
||
rejected = client.post(
|
||
f"/api/roadmap-items/{join_id}/practices",
|
||
json={"title": "Nope", "interval_days": 1},
|
||
headers=_auth(token),
|
||
)
|
||
assert rejected.status_code == 400
|