From fe100d8d9a29b875ac4b62f513bd35370e201d15 Mon Sep 17 00:00:00 2001 From: EwoutV Date: Tue, 5 Mar 2024 15:32:03 +0100 Subject: [PATCH] chore: fixed linting errors --- backend/api/views/admin_view.py | 1 + backend/authentication/permissions.py | 2 +- backend/authentication/tests/test_authentication_serializer.py | 1 + backend/authentication/urls.py | 2 +- backend/authentication/views.py | 3 ++- 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/api/views/admin_view.py b/backend/api/views/admin_view.py index 5c4fabe3..63fdab43 100644 --- a/backend/api/views/admin_view.py +++ b/backend/api/views/admin_view.py @@ -2,6 +2,7 @@ from authentication.serializers import UserSerializer from authentication.models import User + class AdminViewSet(viewsets.ModelViewSet): queryset = User.objects.filter(is_staff=True) serializer_class = UserSerializer diff --git a/backend/authentication/permissions.py b/backend/authentication/permissions.py index 5056df97..d852d767 100644 --- a/backend/authentication/permissions.py +++ b/backend/authentication/permissions.py @@ -8,4 +8,4 @@ def has_permission(self, request: Request, view: ViewSet): """Check whether a user has permission in the CAS flow context.""" return request.user.is_authenticated or view.action not in [ 'logout', 'whoami' - ] \ No newline at end of file + ] diff --git a/backend/authentication/tests/test_authentication_serializer.py b/backend/authentication/tests/test_authentication_serializer.py index b5ef46c4..736ed2f0 100644 --- a/backend/authentication/tests/test_authentication_serializer.py +++ b/backend/authentication/tests/test_authentication_serializer.py @@ -18,6 +18,7 @@ FIRST_NAME = "Dummy" LAST_NAME = "McDickwad" + class UserSerializerModelTests(TestCase): def test_invalid_email_makes_user_serializer_invalid(self): """ diff --git a/backend/authentication/urls.py b/backend/authentication/urls.py index 4365ca54..2214cc67 100644 --- a/backend/authentication/urls.py +++ b/backend/authentication/urls.py @@ -4,7 +4,7 @@ from authentication.views import CASViewSet router = DefaultRouter() -router.register(f"cas", CASViewSet,"cas") +router.register("cas", CASViewSet, "cas") urlpatterns = [ # AUTH endpoints. diff --git a/backend/authentication/views.py b/backend/authentication/views.py index 1b66d8d2..c5f85e29 100644 --- a/backend/authentication/views.py +++ b/backend/authentication/views.py @@ -8,6 +8,7 @@ from authentication.cas.client import client from ypovoli import settings + class CASViewSet(ViewSet): # The IsAuthenticated class is applied by default, # but it's good to be verbose when it comes to security. @@ -43,4 +44,4 @@ def who_am_i(self, request: Request) -> Response: @action(detail=False, methods=['GET'], permission_classes=[AllowAny]) def echo(self, request: Request) -> Response: """Echo the obtained CAS token for development and testing.""" - return Response(request.query_params.get('ticket')) \ No newline at end of file + return Response(request.query_params.get('ticket'))