test_read_access.py 778 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from .withUserTestCase import WithUserTestCase


class ReadAccessTestCase(WithUserTestCase):

    def moreSetUp(self):
        self.api_moderation = '/api/test/moderation/'

    def test_read(self):
        """
        Basic tests to check read access rights
        On MyModelViewset
        """
        response = self.staff_client.get(self.api_moderation)
        self.assertEqual(response.status_code, 200)

        response = self.moderator_client.get(self.api_moderation)
        self.assertEqual(response.status_code, 200)

        response = self.authenticated_client.get(self.api_moderation)
        self.assertEqual(response.status_code, 200)

        response = self.unauthenticated_client.get(self.api_moderation)
        self.assertEqual(response.status_code, 403)