feat(training): delete group button (admin only) on Training page
- Backend DELETE /api/groups/<gid> (admin, own-org enforced via _get_owned_group); cascades removal of the group's sessions. GroupStore.delete added. - Training.vue: each group card gets a trash (Trash2 line icon) delete button shown only to admins (auth.isAdmin); confirm dialog; @click.stop so it doesn't navigate. Card restructured so the delete button is not inside the clickable router-link. - test_user_journey: trainee cannot delete (403), admin deletes, group gone (404). All suites pass. Rebuilt dist.
This commit is contained in:
@@ -93,4 +93,14 @@ after = len(r.get_json()["personas"])
|
||||
assert after > before, f"append should add personas (before={before}, after={after})"
|
||||
print(f"[ok] append adds personas ({before} -> {after}); existing kept")
|
||||
|
||||
# 12. delete group: trainee cannot, admin can
|
||||
r = C.delete(f"/api/groups/{gid}", headers=TH)
|
||||
assert r.status_code == 403, ("trainee must not delete group", r.status_code)
|
||||
print("[ok] trainee cannot delete group (403)")
|
||||
r = C.delete(f"/api/groups/{gid}", headers=AH)
|
||||
assert r.status_code == 200, r.get_json()
|
||||
gone = C.get(f"/api/groups/{gid}", headers=AH)
|
||||
assert gone.status_code == 404, "deleted group should be gone"
|
||||
print("[ok] admin deletes group; group no longer reachable")
|
||||
|
||||
print("ALL USER-JOURNEY FLOW TESTS PASSED")
|
||||
|
||||
Reference in New Issue
Block a user