feat(lea): add dashboard competence promotion dry run

This commit is contained in:
Dom
2026-05-29 21:48:00 +02:00
parent bd3aaf7d64
commit 34527b5cc5
8 changed files with 1341 additions and 1 deletions

View File

@@ -107,3 +107,42 @@ def test_list_competence_verdicts_endpoint(monkeypatch):
assert data["verdicts"] == [
{"competence_id": "key_win_r_wait_explorer_exe", "verdict_kind": "valid"}
]
def test_promote_competence_endpoint_dry_run(monkeypatch):
def fake_promote(competence_id, payload):
assert competence_id == "key_win_r_wait_explorer_exe"
assert payload["dry_run"] is True
return {
"promotion_id": payload["promotion_id"],
"competence_id": competence_id,
"target_state": "candidate",
"dry_run": True,
"eligible": True,
"dry_run_token": "token",
"write_applied": False,
}
monkeypatch.setattr(
lea_competences_module,
"promote_competence_from_verdicts",
fake_promote,
)
with _app().test_client() as client:
response = client.post(
"/api/v1/lea/competences/key_win_r_wait_explorer_exe/promote",
json={
"promotion_id": "123e4567-e89b-42d3-a456-426614174000",
"target_state": "candidate",
"verdict_ids": ["123e4567-e89b-42d3-a456-426614174001"],
"confirmed_by": "human:dom",
"dry_run": True,
},
)
data = response.get_json()
assert response.status_code == 200
assert data["success"] is True
assert data["dry_run"] is True
assert data["yaml_write"] is False