diff --git a/src/objecttypes/tests/v1/test_auth.py b/src/objecttypes/tests/v1/test_auth.py index 47aac43a..0f7ef698 100644 --- a/src/objecttypes/tests/v1/test_auth.py +++ b/src/objecttypes/tests/v1/test_auth.py @@ -25,7 +25,7 @@ def test_invalid_token(self): TokenAuth.objects.create(contact_person="John Smith", email="smith@bomen.nl") for url in self.urls: with self.subTest(url=url): - response = self.client.get(url, HTTP_AUTHORIZATION=f"Token 12345") + response = self.client.get(url, HTTP_AUTHORIZATION="Token 12345") self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) def test_valid_token(self): diff --git a/src/objecttypes/tests/v1/test_filters.py b/src/objecttypes/tests/v1/test_filters.py index 5bf13191..1c1b2728 100644 --- a/src/objecttypes/tests/v1/test_filters.py +++ b/src/objecttypes/tests/v1/test_filters.py @@ -15,9 +15,7 @@ def test_filter_public_data(self): object_type_1 = ObjectTypeFactory.create( data_classification=DataClassificationChoices.open ) - object_type_2 = ObjectTypeFactory.create( - data_classification=DataClassificationChoices.intern - ) + ObjectTypeFactory.create(data_classification=DataClassificationChoices.intern) response = self.client.get( self.url, {"dataClassification": DataClassificationChoices.open} diff --git a/src/objecttypes/tests/v1/test_objecttype_api.py b/src/objecttypes/tests/v1/test_objecttype_api.py index de47842a..e6c6e512 100644 --- a/src/objecttypes/tests/v1/test_objecttype_api.py +++ b/src/objecttypes/tests/v1/test_objecttype_api.py @@ -21,6 +21,10 @@ def test_get_objecttypes(self): response = self.client.get(url) + version_path = reverse( + "objectversion-detail", args=[object_type.uuid, object_version.version] + ) + self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual( response.json(), @@ -43,9 +47,7 @@ def test_get_objecttypes(self): "createdAt": "2020-01-01", "modifiedAt": "2020-01-01", "allowGeometry": object_type.allow_geometry, - "versions": [ - f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_version.version])}" - ], + "versions": [f"http://testserver{version_path}"], }, ) @@ -63,13 +65,16 @@ def test_get_objecttypes_with_versions(self): self.assertEqual(response.status_code, status.HTTP_200_OK) + version_path = reverse( + "objectversion-detail", + args=[object_type.uuid, object_versions[i].version], + ) + data = response.json() self.assertEqual(len(data["versions"]), 1) self.assertEqual( data["versions"], - [ - f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_versions[i].version])}" - ], + [f"http://testserver{version_path}"], ) def test_create_objecttype(self): diff --git a/src/objecttypes/tests/v1/test_objectversion_api.py b/src/objecttypes/tests/v1/test_objectversion_api.py index c729d791..3c46fcdc 100644 --- a/src/objecttypes/tests/v1/test_objectversion_api.py +++ b/src/objecttypes/tests/v1/test_objectversion_api.py @@ -29,14 +29,22 @@ def test_get_versions(self): response = self.client.get(url) + object_path = reverse( + "objectversion-detail", args=[object_type.uuid, object_version.version] + ) + + objecttype_path = reverse( + "objecttype-detail", args=[object_version.object_type.uuid] + ) + self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual( response.json(), [ { - "url": f"http://testserver{reverse('objectversion-detail', args=[object_type.uuid, object_version.version])}", + "url": f"http://testserver{object_path}", "version": object_version.version, - "objectType": f"http://testserver{reverse('objecttype-detail', args=[object_version.object_type.uuid])}", + "objectType": f"http://testserver{objecttype_path}", "status": object_version.status, "createdAt": "2020-01-01", "modifiedAt": "2020-01-01",