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
807 B

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