diff --git a/src/entrypoints/api/routers/profile.py b/src/entrypoints/api/routers/profile.py index a75820b..fdbe2a7 100644 --- a/src/entrypoints/api/routers/profile.py +++ b/src/entrypoints/api/routers/profile.py @@ -35,7 +35,7 @@ async def create_profile( legacy=dto.legacy, ) except DuplicateProfileError as e: - raise HTTPException(status_code=400, detail=str(e)) + raise HTTPException(status_code=409, detail=str(e)) except InvalidConfirmPasswordError as e: raise HTTPException(status_code=400, detail=str(e)) except InvalidFormatEmailError as e: diff --git a/src/entrypoints/api/tests/profile.py b/src/entrypoints/api/tests/profile.py index fb09c6a..456990e 100644 --- a/src/entrypoints/api/tests/profile.py +++ b/src/entrypoints/api/tests/profile.py @@ -78,7 +78,7 @@ async def test_06_user_cannot_update_roles(self, client): ) assert r.status_code == 403 - async def test_07_create_duplicate_user_profile_returns_400(self, client): + async def test_07_create_duplicate_user_profile_returns_409(self, client): payload = { "email": "alice@example.com", "password": "Secret123!", @@ -86,7 +86,7 @@ async def test_07_create_duplicate_user_profile_returns_400(self, client): "name": "Alice Dup" } r = await client.post("/profiles", json=payload) - assert r.status_code == 400 + assert r.status_code == 409 assert "already exists" in r.json()["detail"].lower() async def test_08_coach_cannot_update_user_profile(self, client):