Change status code of 'AA not assigned to group'

This commit is contained in:
2026-06-04 15:05:42 +02:00
parent d00c5855b7
commit 427e47534a
2 changed files with 2 additions and 3 deletions

View File

@@ -59,7 +59,7 @@ def unassign_accessauth(*, db: Session = Depends(get_session), group_id: int, aa
if db_aa is None:
raise HTTPException(status_code=404, detail="AA not found")
if db_aa not in db_group.accessauths:
raise HTTPException(status_code=200, detail="AA not assigned to group")
raise HTTPException(status_code=404, detail="AA not assigned to group")
db_group.accessauths.remove(db_aa)
return add_and_refresh(db, db_group)

View File

@@ -99,8 +99,7 @@ def test_unassign_nonexistent_assignment(client, auth_headers, test_group, test_
f"/aa/unassign/{test_group.id}/{test_aa.id}",
headers=auth_headers
)
# According to the code, this returns 200 with "not assigned" message
assert response.status_code == 200
assert response.status_code == 404
def test_assign_to_nonexistent_group(client, auth_headers, test_aa):