Skip to content

Commit

Permalink
test: add test for content-metdata retrieve without customer query param
Browse files Browse the repository at this point in the history
ENT-7788
  • Loading branch information
pwnage101 committed Oct 26, 2023
1 parent 9a7e56b commit a3f2f11
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion enterprise_subsidy/apps/api/v1/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1461,13 +1461,24 @@ def test_successful_get(
'geag_variant_id': expected_geag_variant_id,
}

def test_failure_no_permission(self):
def test_retrieve_failure_no_permission(self):
self.set_up_admin(enterprise_uuids=[str(uuid.uuid4())])
url = reverse('api:v1:content-metadata', kwargs={'content_identifier': self.content_key_1})
response = self.client.get(url + f'?enterprise_customer_uuid={str(uuid.uuid4())}')
assert response.status_code == 403
assert response.json() == {'detail': 'MISSING: subsidy.can_read_metadata'}

def test_retrieve_failure_no_query_param(self):
"""
When no `enterprise_customer_uuid` query param is supplied by the requester, test reponse is 403.
"""
customer_uuid = uuid.uuid4()
self.set_up_admin(enterprise_uuids=[str(customer_uuid)])
url = reverse('api:v1:content-metadata', kwargs={'content_identifier': self.content_key_1})
response = self.client.get(url)
assert response.status_code == 403
assert response.json() == {'detail': 'MISSING: subsidy.can_read_metadata'}

@ddt.data(
{
'catalog_status_code': 404,
Expand Down

0 comments on commit a3f2f11

Please sign in to comment.