Skip to content

Commit

Permalink
✅[#449] change permission tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Coperh committed Sep 27, 2024
1 parent c465f53 commit 90fe0e4
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/objects/token/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,23 @@ def test_with_object_types_api_v1(self):
header_key="Authorization",
header_value="Token 5cebbb33ffa725b6ed5e9e98300061218ba98d71",
)
ObjectTypeFactory(
object_type = ObjectTypeFactory(
service=v1_service, uuid="71a2452a-66c3-4030-b5ec-a06035102e9e"
)

response = self.client.get(self.url)

print(response)
self.assertEqual(response.status_code, 200)

form = response.context["adminform"].form
choices = list(form.fields["object_type"].choices)

self.assertEqual(
self.cassette.requests[1].uri,
"http://127.0.0.1:8008/api/v1/objecttypes/71a2452a-66c3-4030-b5ec-a06035102e9e/versions",
choices[1][0].value,
object_type.id,
)


@tag("#449")
def test_with_object_types_api_v2(self):
"""
Expand All @@ -66,14 +69,17 @@ def test_with_object_types_api_v2(self):
header_key="Authorization",
header_value="Token 5cebbb33ffa725b6ed5e9e98300061218ba98d71",
)
ObjectTypeFactory(
object_type = ObjectTypeFactory(
service=v2_service, uuid="71a2452a-66c3-4030-b5ec-a06035102e9e"
)

response = self.client.get(self.url)
self.assertEqual(response.status_code, 200)

form = response.context["adminform"].form
choices = list(form.fields["object_type"].choices)

self.assertEqual(
self.cassette.requests[1].uri,
"http://127.0.0.1:8008/api/v2/objecttypes/71a2452a-66c3-4030-b5ec-a06035102e9e/versions",
choices[1][0].value,
object_type.id,
)

0 comments on commit 90fe0e4

Please sign in to comment.