Skip to content
Merged
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
4 changes: 2 additions & 2 deletions app/api/auth/router_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@
translator=translator,
),
PasswordPolicyError: rule(
status=status.HTTP_422_UNPROCESSABLE_ENTITY,
status=status.HTTP_422_UNPROCESSABLE_CONTENT,
translator=translator,
),
UserNotFoundError: rule(
status=status.HTTP_400_BAD_REQUEST,
translator=translator,
),
AuthValidationError: rule(
status=status.HTTP_422_UNPROCESSABLE_ENTITY,
status=status.HTTP_422_UNPROCESSABLE_CONTENT,
translator=translator,
),
MFARequiredError: rule(
Expand Down
2 changes: 1 addition & 1 deletion app/api/auth/router_mfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
translator=translator,
),
InvalidCredentialsError: rule(
status=status.HTTP_422_UNPROCESSABLE_ENTITY,
status=status.HTTP_422_UNPROCESSABLE_CONTENT,
translator=translator,
),
NotFoundError: rule(
Expand Down
6 changes: 3 additions & 3 deletions app/api/dhcp/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
DHCPEntryNotFoundError,
DHCPEntryUpdateError,
DHCPOperationError,
DHCPValidatonError,
DHCPValidationError,
)
from ldap_protocol.dhcp.schemas import (
DHCPChangeStateSchemaRequest,
Expand Down Expand Up @@ -65,8 +65,8 @@
status=status.HTTP_400_BAD_REQUEST,
translator=translator,
),
DHCPValidatonError: rule(
status=status.HTTP_422_UNPROCESSABLE_ENTITY,
DHCPValidationError: rule(
status=status.HTTP_422_UNPROCESSABLE_CONTENT,
translator=translator,
),
DHCPOperationError: rule(
Expand Down
2 changes: 1 addition & 1 deletion app/api/main/dns_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

error_map: ERROR_MAP_TYPE = {
dns_exc.DNSSetupError: rule(
status=status.HTTP_422_UNPROCESSABLE_ENTITY,
status=status.HTTP_422_UNPROCESSABLE_CONTENT,
translator=translator,
),
dns_exc.DNSRecordCreateError: rule(
Expand Down
4 changes: 2 additions & 2 deletions app/api/network/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@

error_map: ERROR_MAP_TYPE = {
NetworkPolicyAlreadyExistsError: rule(
status=status.HTTP_422_UNPROCESSABLE_ENTITY,
status=status.HTTP_422_UNPROCESSABLE_CONTENT,
translator=translator,
),
NetworkPolicyNotFoundError: rule(
status=status.HTTP_400_BAD_REQUEST,
translator=translator,
),
LastActivePolicyError: rule(
status=status.HTTP_422_UNPROCESSABLE_ENTITY,
status=status.HTTP_422_UNPROCESSABLE_CONTENT,
translator=translator,
),
}
Expand Down
2 changes: 1 addition & 1 deletion app/api/network/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ async def check_policy_count(session: AsyncSession) -> None:

if count.one() == 1:
raise HTTPException(
status.HTTP_422_UNPROCESSABLE_ENTITY,
status.HTTP_422_UNPROCESSABLE_CONTENT,
"At least one policy should be active",
)
2 changes: 1 addition & 1 deletion app/api/shadow/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
translator=translator,
),
PasswordPolicyError: rule(
status=status.HTTP_422_UNPROCESSABLE_ENTITY,
status=status.HTTP_422_UNPROCESSABLE_CONTENT,
translator=translator,
),
PermissionError: rule(
Expand Down
4 changes: 2 additions & 2 deletions app/ldap_protocol/dhcp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
DHCPEntryNotFoundError,
DHCPEntryUpdateError,
DHCPOperationError,
DHCPValidatonError,
DHCPValidationError,
)
from .kea_dhcp_manager import KeaDHCPManager
from .kea_dhcp_repository import KeaDHCPAPIRepository
Expand Down Expand Up @@ -54,7 +54,7 @@ def get_dhcp_api_repository_class(
"DHCPEntryDeleteError",
"DHCPEntryAddError",
"DHCPEntryUpdateError",
"DHCPValidatonError",
"DHCPValidationError",
"DHCPOperationError",
"DHCPAPIError",
"DHCPSubnetSchemaRequest",
Expand Down
2 changes: 1 addition & 1 deletion app/ldap_protocol/dhcp/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DHCPAPIError(DHCPError):
code = ErrorCodes.DHCP_API_ERROR


class DHCPValidatonError(DHCPError):
class DHCPValidationError(DHCPError):
"""DHCP validation error."""

code = ErrorCodes.DHCP_VALIDATION_ERROR
Expand Down
6 changes: 1 addition & 5 deletions app/ldap_protocol/dns/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from ldap_protocol.dns.dto import DNSSettingDTO

from .exceptions import DNSSetupError
from .exceptions import DNSNotImplementedError, DNSSetupError

DNS_MANAGER_STATE_NAME = "DNSManagerState"
DNS_MANAGER_ZONE_NAME = "DNSManagerZoneName"
Expand Down Expand Up @@ -46,10 +46,6 @@ class DNSForwarderServerStatus(StrEnum):
NOT_FOUND = "not found"


class DNSNotImplementedError(NotImplementedError):
"""API Not Implemented Error."""


class DNSRecordType(StrEnum):
"""DNS record types."""

Expand Down
2 changes: 1 addition & 1 deletion interface
4 changes: 2 additions & 2 deletions tests/test_api/test_auth/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ async def test_first_setup_with_invalid_domain(
"/auth/setup",
json=test_case,
)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT

response = await unbound_http_client.get("/auth/setup")
assert response.status_code == status.HTTP_200_OK
Expand Down Expand Up @@ -384,7 +384,7 @@ async def test_update_password_with_empty_old_password(
},
)

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

new_auth = await http_client.post(
"auth/",
Expand Down
8 changes: 4 additions & 4 deletions tests/test_api/test_dhcp/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ async def test_create_subnet_invalid_data(
json=invalid_data,
)

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


@pytest.mark.asyncio
Expand Down Expand Up @@ -297,7 +297,7 @@ async def test_create_lease_invalid_data(
json=invalid_data,
)

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


@pytest.mark.asyncio
Expand Down Expand Up @@ -486,7 +486,7 @@ async def test_create_reservation_invalid_data(
json=invalid_data,
)

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


@pytest.mark.asyncio
Expand Down Expand Up @@ -597,7 +597,7 @@ async def test_delete_reservation_missing_params(
"""Test reservation deletion with missing parameters."""
response = await http_client.delete("/dhcp/reservation")

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


@pytest.mark.asyncio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@
{
"attribute_type_schemas": [],
"attribute_types_deleted": [],
"status_code": status.HTTP_422_UNPROCESSABLE_ENTITY,
"status_code": status.HTTP_422_UNPROCESSABLE_CONTENT,
},
]
2 changes: 1 addition & 1 deletion tests/test_api/test_ldap_schema/test_entity_type_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async def test_create_one_entity_type_value_422(
"is_system": False,
},
)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT


@pytest.mark.parametrize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
{
"object_class_datas": [],
"object_classes_deleted": [],
"status_code": status.HTTP_422_UNPROCESSABLE_ENTITY,
"status_code": status.HTTP_422_UNPROCESSABLE_CONTENT,
},
{
"object_class_datas": [
Expand Down
4 changes: 2 additions & 2 deletions tests/test_api/test_network/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ async def test_delete_policy(
assert response[0]["priority"] == 1

response = await http_client.delete(f"/policy/{pol_id2}")
assert response.status_code == 422
assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
assert response.json()["detail"] == "At least one policy should be active"


Expand Down Expand Up @@ -314,7 +314,7 @@ async def test_switch_policy(
assert response.json()[0]["enabled"] is False

response = await http_client.patch(f"/policy/{pol_id2}")
assert response.status_code == 422
assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
assert response.json()["detail"] == "At least one policy should be active"


Expand Down