From 79caead723c817ff938bca3979e8366aab8f4459 Mon Sep 17 00:00:00 2001 From: Bram Meir Date: Thu, 7 Mar 2024 10:00:37 +0100 Subject: [PATCH] fix: - instead of _ --- backend/api/serializers/project_serializer.py | 4 ++-- backend/api/serializers/submission_serializer.py | 2 +- backend/api/tests/test_checks.py | 16 ++++++++-------- backend/api/urls.py | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/backend/api/serializers/project_serializer.py b/backend/api/serializers/project_serializer.py index 2dbe9c79..f9c458d5 100644 --- a/backend/api/serializers/project_serializer.py +++ b/backend/api/serializers/project_serializer.py @@ -8,11 +8,11 @@ class ProjectSerializer(serializers.ModelSerializer): ) structure_checks = serializers.HyperlinkedRelatedField( - many=True, read_only=True, view_name="structure_check-detail" + many=True, read_only=True, view_name="structure-check-detail" ) extra_checks = serializers.HyperlinkedRelatedField( - many=True, read_only=True, view_name="extra_check-detail" + many=True, read_only=True, view_name="extra-check-detail" ) groups = serializers.HyperlinkedIdentityField( diff --git a/backend/api/serializers/submission_serializer.py b/backend/api/serializers/submission_serializer.py index 00ff8312..744cd4ac 100644 --- a/backend/api/serializers/submission_serializer.py +++ b/backend/api/serializers/submission_serializer.py @@ -13,7 +13,7 @@ class ExtraChecksResultSerializer(serializers.ModelSerializer): extra_check = serializers.HyperlinkedRelatedField( many=False, read_only=True, - view_name="extra_check-detail" + view_name="extra-check-detail" ) class Meta: diff --git a/backend/api/tests/test_checks.py b/backend/api/tests/test_checks.py index 49781271..b66251b8 100644 --- a/backend/api/tests/test_checks.py +++ b/backend/api/tests/test_checks.py @@ -89,7 +89,7 @@ def test_no_fileExtension(self): """ Able to retrieve no FileExtension before publishing it. """ - response_root = self.client.get(reverse("fileExtension-list"), follow=True) + response_root = self.client.get(reverse("file-extension-list"), follow=True) self.assertEqual(response_root.status_code, 200) # Assert that the response is JSON self.assertEqual(response_root.accepted_media_type, "application/json") @@ -105,7 +105,7 @@ def test_fileExtension_exists(self): fileExtension = create_fileExtension(id=5, extension="pdf") # Make a GET request to retrieve the fileExtension - response = self.client.get(reverse("fileExtension-list"), follow=True) + response = self.client.get(reverse("file-extension-list"), follow=True) # Check if the response was successful self.assertEqual(response.status_code, 200) @@ -133,7 +133,7 @@ def test_multiple_fileExtension(self): fileExtension2 = create_fileExtension(id=2, extension="png") # Make a GET request to retrieve the fileExtension - response = self.client.get(reverse("fileExtension-list"), follow=True) + response = self.client.get(reverse("file-extension-list"), follow=True) # Check if the response was successful self.assertEqual(response.status_code, 200) @@ -167,7 +167,7 @@ def test_fileExtension_detail_view(self): # Make a GET request to retrieve the fileExtension details response = self.client.get( - reverse("fileExtension-detail", args=[str(fileExtension.id)]), follow=True + reverse("file-extension-detail", args=[str(fileExtension.id)]), follow=True ) # Check if the response was successful @@ -194,7 +194,7 @@ def test_no_checks(self): """ Able to retrieve no Checks before publishing it. """ - response_root = self.client.get(reverse("structure_check-list"), follow=True) + response_root = self.client.get(reverse("structure-check-list"), follow=True) self.assertEqual(response_root.status_code, 200) self.assertEqual(response_root.accepted_media_type, "application/json") content_json = json.loads(response_root.content.decode("utf-8")) @@ -218,7 +218,7 @@ def test_structure_checks_exists(self): ) # Make a GET request to retrieve the Checks - response = self.client.get(reverse("structure_check-list"), follow=True) + response = self.client.get(reverse("structure-check-list"), follow=True) # Check if the response was successful self.assertEqual(response.status_code, 200) @@ -270,7 +270,7 @@ def test_no_checks(self): """ Able to retrieve no Checks before publishing it. """ - response_root = self.client.get(reverse("extra_check-list"), follow=True) + response_root = self.client.get(reverse("extra-check-list"), follow=True) self.assertEqual(response_root.status_code, 200) self.assertEqual(response_root.accepted_media_type, "application/json") content_json = json.loads(response_root.content.decode("utf-8")) @@ -285,7 +285,7 @@ def test_extra_checks_exists(self): ) # Make a GET request to retrieve the Checks - response = self.client.get(reverse("extra_check-list"), follow=True) + response = self.client.get(reverse("extra-check-list"), follow=True) # Check if the response was successful self.assertEqual(response.status_code, 200) diff --git a/backend/api/urls.py b/backend/api/urls.py index 4aa067ca..094e2fce 100644 --- a/backend/api/urls.py +++ b/backend/api/urls.py @@ -25,9 +25,9 @@ router.register(r"groups", GroupViewSet, basename="group") router.register(r"courses", CourseViewSet, basename="course") router.register(r"submissions", SubmissionViewSet, basename="submission") -router.register(r"structure_checks", StructureCheckViewSet, basename="structure_check") -router.register(r"extra_checks", ExtraCheckViewSet, basename="extra_check") -router.register(r"fileExtensions", FileExtensionViewSet, basename="fileExtension") +router.register(r"structure-checks", StructureCheckViewSet, basename="structure-check") +router.register(r"extra-checks", ExtraCheckViewSet, basename="extra-check") +router.register(r"file-extensions", FileExtensionViewSet, basename="file-extension") router.register(r"faculties", FacultyViewSet, basename="faculty") urlpatterns = [