diff --git a/app/controllers/aaManager.py b/app/controllers/aaManager.py index c1de3fd..d75c83c 100644 --- a/app/controllers/aaManager.py +++ b/app/controllers/aaManager.py @@ -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) diff --git a/test/test_services/test_aa_manager.py b/test/test_services/test_aa_manager.py index 292397f..25a8f04 100644 --- a/test/test_services/test_aa_manager.py +++ b/test/test_services/test_aa_manager.py @@ -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):