Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/apps/shared/domain/response/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ class ErrorResponseMulti(PublicModel):
DEFAULT_OPENAPI_RESPONSE: ResponseType = {
# status.HTTP_500_INTERNAL_SERVER_ERROR: __DEFAULT_ERROR_RESPONSE,
status.HTTP_400_BAD_REQUEST: __DEFAULT_ERROR_RESPONSE,
status.HTTP_422_UNPROCESSABLE_ENTITY: __DEFAULT_ERROR_RESPONSE,
status.HTTP_422_UNPROCESSABLE_CONTENT: __DEFAULT_ERROR_RESPONSE,
}
2 changes: 1 addition & 1 deletion src/apps/shared/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class NotFoundError(BaseError):

class FieldError(BaseError):
message = _("Invalid value.")
status_code = status.HTTP_422_UNPROCESSABLE_ENTITY
status_code = status.HTTP_422_UNPROCESSABLE_CONTENT
type = ExceptionTypes.INVALID_VALUE
zero_path: str | None = "body"

Expand Down
2 changes: 1 addition & 1 deletion src/apps/users/tests/test_mfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ async def test_mfa_totp_verify_invalid_code_format(self, client: TestClient, use
data={"code": "12345"}, # Only 5 digits
)

assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT

async def test_mfa_status_in_user_retrieve(self, client: TestClient, user: User, session: AsyncSession):
"""Test that /users/me returns mfaEnabled status."""
Expand Down
2 changes: 1 addition & 1 deletion src/apps/users/tests/test_mfa_disable_confirm.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async def test_confirm_without_token_fails(self, client: TestClient, user_with_m

# Try to confirm without token
response = await client.post(self.disable_confirm_url, data={})
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT

async def test_confirm_with_invalid_token_fails(self, client: TestClient, user_with_mfa: User):
"""Confirmation with invalid token returns error."""
Expand Down
2 changes: 1 addition & 1 deletion src/apps/users/tests/test_mfa_disable_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ async def test_sql_injection_in_totp_code(self, client: TestClient, user_with_mf
# Should fail safely (validation error or invalid code)
assert response.status_code in (
status.HTTP_400_BAD_REQUEST,
status.HTTP_422_UNPROCESSABLE_ENTITY,
status.HTTP_422_UNPROCESSABLE_CONTENT,
)

async def test_xss_in_response_messages(self, client: TestClient, user_with_mfa: User):
Expand Down
2 changes: 1 addition & 1 deletion src/apps/users/tests/test_mfa_disable_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async def test_disable_verify_without_mfa_token_fails(self, client: TestClient,
verify_data = {"code": "123456"}
response = await client.post(self.disable_verify_url, data=verify_data)

assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT

async def test_disable_verify_with_valid_recovery_code_emits_recovery_use_audit(
self, client: TestClient, user_with_mfa: User, session: AsyncSession, mocker: MockerFixture
Expand Down
2 changes: 1 addition & 1 deletion src/apps/users/tests/test_mfa_recovery_codes_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ async def test_download_without_token_fails(self, client: TestClient, user: User
resp = await client.get(self.recovery_codes_download_url)

# Assertions - Should fail due to missing required parameter
assert resp.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
assert resp.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT

async def test_download_with_invalid_token_fails(self, client: TestClient, user: User, session: AsyncSession):
"""Test that download fails with invalid download_token."""
Expand Down
2 changes: 1 addition & 1 deletion src/apps/users/tests/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ async def test_create_user_not_valid_email(self, client: TestClient, request_dat
data = request_data.model_dump()
data["email"] = "tom2@gettingcurious@com"
response = await client.post(self.user_create_url, data=data)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
result = response.json()["result"]
assert len(result) == 1
assert (
Expand Down
2 changes: 1 addition & 1 deletion src/infrastructure/http/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def pydantic_validation_errors_handler(request: Request, error: RequestValidatio
response = ErrorResponseMulti(result=errors)
return JSONResponse(
content=jsonable_encoder(response.model_dump(by_alias=True)),
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
)


Expand Down
Loading