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.

19 lines
580 B

  1. from rest_framework import status
  2. from rest_framework.reverse import reverse
  3. from api.tests.api.utils import (CRUDMixin, create_default_roles, make_user)
  4. class TestRoleAPI(CRUDMixin):
  5. @classmethod
  6. def setUpTestData(cls):
  7. create_default_roles()
  8. cls.user = make_user()
  9. cls.url = reverse(viewname='roles')
  10. def test_allows_authenticated_user_to_get_roles(self):
  11. self.assert_fetch(self.user, status.HTTP_200_OK)
  12. def test_denies_unauthenticated_user_to_get_roles(self):
  13. self.assert_fetch(expected=status.HTTP_403_FORBIDDEN)