test_is_moderation_required.py 818 Bytes
Newer Older
1 2 3 4
from django.test import override_settings
from .withUserTestCase import WithUserTestCase
from backend.permissions import is_moderation_required

5 6
model_config = {'moderation_level': 2}

7 8 9 10 11

class IsModerationActivatedTestCase(WithUserTestCase):

    @override_settings(MODERATION_ACTIVATED=True)
    def test_is_moderation_1(self):
12 13 14 15
        self.assertFalse(is_moderation_required(
            model_config, None, self.staff_user))
        self.assertFalse(is_moderation_required(
            model_config, None, self.staff_user, 3))
16 17 18

    @override_settings(MODERATION_ACTIVATED=False)
    def test_is_moderation_2(self):
19 20 21 22
        self.assertFalse(is_moderation_required(
            model_config, None, self.staff_user))
        self.assertFalse(is_moderation_required(
            model_config, None, self.staff_user, 3))