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.

20 lines
620 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 users.tests.utils import make_user
  5. from .utils import create_default_roles
  6. class TestRoleAPI(CRUDMixin):
  7. @classmethod
  8. def setUpTestData(cls):
  9. create_default_roles()
  10. cls.user = make_user()
  11. cls.url = reverse(viewname="roles")
  12. def test_allows_authenticated_user_to_get_roles(self):
  13. self.assert_fetch(self.user, status.HTTP_200_OK)
  14. def test_denies_unauthenticated_user_to_get_roles(self):
  15. self.assert_fetch(expected=status.HTTP_403_FORBIDDEN)