Skip to content

Commit

Permalink
[#513] apply formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
SonnyBA committed Jan 10, 2025
1 parent 27a1ef4 commit bb7084a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/objecttypes/tests/v1/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_invalid_token(self):
TokenAuth.objects.create(contact_person="John Smith", email="[email protected]")
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):
Expand Down
4 changes: 1 addition & 3 deletions src/objecttypes/tests/v1/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
17 changes: 11 additions & 6 deletions src/objecttypes/tests/v1/test_objecttype_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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}"],
},
)

Expand All @@ -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):
Expand Down
12 changes: 10 additions & 2 deletions src/objecttypes/tests/v1/test_objectversion_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit bb7084a

Please sign in to comment.