Commit a57a45ae authored by Florent Chehab's avatar Florent Chehab
Browse files

Moved test_read

parent 77048105
...@@ -8,25 +8,11 @@ from django.conf import settings ...@@ -8,25 +8,11 @@ from django.conf import settings
class ModerationTestCase(WithUserTestCase): class ModerationTestCase(WithUserTestCase):
def test_setting_ok(self):
self.assertTrue(settings.TESTING)
def moreSetUp(self): def moreSetUp(self):
self.api_moderation = '/api/test/moderation/' self.api_moderation = '/api/test/moderation/'
def test_read(self): def test_setting_ok(self):
""" self.assertTrue(settings.TESTING)
TODO à déplacer ailleur
Basic tests to check read access rights
"""
response = self.staff_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)
@override_settings(MODERATION_ACTIVATED=True) @override_settings(MODERATION_ACTIVATED=True)
def test_moderation_activated(self): def test_moderation_activated(self):
......
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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment