You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
785 B

  1. from rest_framework import status
  2. from rest_framework.reverse import reverse
  3. from api.models import DOCUMENT_CLASSIFICATION
  4. from api.tests.api.utils import CRUDMixin, prepare_project
  5. class TestDownloadCatalog(CRUDMixin):
  6. def setUp(self):
  7. self.project = prepare_project(task=DOCUMENT_CLASSIFICATION)
  8. self.url = reverse(viewname='download-format', args=[self.project.item.id])
  9. def test_allows_project_admin_to_list_catalog(self):
  10. response = self.assert_fetch(self.project.users[0], status.HTTP_200_OK)
  11. for item in response.data:
  12. self.assertIn('name', item)
  13. def test_denies_non_project_admin_to_list_catalog(self):
  14. for member in self.project.users[1:]:
  15. self.assert_fetch(member, status.HTTP_403_FORBIDDEN)