test_mymodel_validate.py 530 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
from django.test import TestCase
from backend.models.my_model.myModel import validate_obj_model_lv
import pytest
from django.core.exceptions import ValidationError
from backend.permissions import OBJ_MODERATION_PERMISSIONS


class MyModelTestCase(TestCase):

    def test_my_model_validation(self):
        with pytest.raises(ValidationError):
            value = "bernard"
            validate_obj_model_lv(value)

        for key in OBJ_MODERATION_PERMISSIONS:
            validate_obj_model_lv(OBJ_MODERATION_PERMISSIONS[key])