AP1.8a: Portfolio-Rang im Cockpit mit Reorder und Next-Action-Sortierung.
Deploy Development / deploy (push) Successful in 50s
Test Suite / pytest-backend (push) Successful in 2m21s
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 18s
Test Suite / playwright-smoke (push) Successful in 21s
Deploy Development / deploy (push) Successful in 50s
Test Suite / pytest-backend (push) Successful in 2m21s
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 18s
Test Suite / playwright-smoke (push) Successful in 21s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d7aefed0de
commit
a19c6abd26
16 files changed
+426
-34
No files matched your search
@@ -0,0 +1,47 @@
|
||||
"""Unit tests for portfolio priority sorting — AP1.8a."""
|
||||
|
||||
from steering.portfolio.priority import sort_candidates_by_portfolio_rank
|
||||
|
||||
|
||||
def test_sort_candidates_by_portfolio_rank():
|
||||
candidates = [
|
||||
{"kind": "a", "initiative_id": "low"},
|
||||
{"kind": "b", "initiative_id": "high"},
|
||||
{"kind": "c", "initiative_id": "mid"},
|
||||
]
|
||||
rank_map = {"high": 0, "mid": 1, "low": 2}
|
||||
sorted_items = sort_candidates_by_portfolio_rank(candidates, rank_map)
|
||||
assert [c["initiative_id"] for c in sorted_items] == ["high", "mid", "low"]
|
||||
assert sorted_items[0]["portfolio_rank"] == 0
|
||||
|
||||
|
||||
def test_null_rank_sorts_last():
|
||||
candidates = [
|
||||
{"initiative_id": "unknown"},
|
||||
{"initiative_id": "ranked"},
|
||||
]
|
||||
rank_map = {"ranked": 0}
|
||||
sorted_items = sort_candidates_by_portfolio_rank(candidates, rank_map)
|
||||
assert sorted_items[0]["initiative_id"] == "ranked"
|
||||
|
||||
|
||||
def test_portfolio_reorder_api(client):
|
||||
from tests.test_initiatives_actions import _auth, _create_initiative, _login
|
||||
from tests.factories import provision_user_in_tenant
|
||||
|
||||
user = provision_user_in_tenant(tenant_role="member")
|
||||
token = _login(client, user)
|
||||
|
||||
first = _create_initiative(client, token, title="Alpha").json()
|
||||
second = _create_initiative(client, token, title="Beta").json()
|
||||
|
||||
reorder = client.post(
|
||||
"/api/workspace/portfolio/reorder",
|
||||
json={"initiative_ids": [second["id"], first["id"]]},
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert reorder.status_code == 200
|
||||
ordered = reorder.json()
|
||||
assert ordered[0]["id"] == second["id"]
|
||||
assert ordered[0]["portfolio_rank"] == 0
|
||||
assert ordered[1]["portfolio_rank"] == 1
|
||||
Reference in new issue
Block a user