🚨(backend) handle new checks introduced in Pylint v3.2.0

Pylint 3.2.0 introduced a new check `possibly-used-before-assignment`, which
ensures variables are defined regardless of conditional statements.

Some if/else branches were missing defaults. These have been fixed.
This commit is contained in:
antoine lebaud
2024-05-31 12:29:58 +02:00
committed by aleb_the_flash
parent 04717fd629
commit e0739689e6
2 changed files with 5 additions and 0 deletions

View File

@@ -23,6 +23,8 @@ def exception_handler(exc, context):
detail = exc.message
elif hasattr(exc, "messages"):
detail = exc.messages
else:
detail = ""
exc = drf_exceptions.ValidationError(detail=detail)

View File

@@ -349,6 +349,8 @@ def test_api_team_invitations__update__forbidden(method):
client = APIClient()
client.force_login(user)
response = None
if method == "put":
response = client.put(
f"/api/v1.0/teams/{invitation.team.id}/invitations/{invitation.id}/",
@@ -357,6 +359,7 @@ def test_api_team_invitations__update__forbidden(method):
response = client.patch(
f"/api/v1.0/teams/{invitation.team.id}/invitations/{invitation.id}/",
)
assert response is not None
assert response.status_code == status.HTTP_405_METHOD_NOT_ALLOWED
assert response.json()["detail"] == f'Method "{method.upper()}" not allowed.'