test_scholarhip_validate.py 595 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
from django.test import TestCase
from backend.models.module.scholarship import ScholarshipSerializer
import pytest
from rest_framework.validators import ValidationError


class ScholarshipTestCase(TestCase):

    def test_scholarhip_validation(self):
        ser = ScholarshipSerializer()
        with pytest.raises(ValidationError):
            attrs = {
                'amount_max': 100,
                'amount_min': 200
            }
            ser.my_validate(attrs)

        attrs = {
            'amount_max': 200,
            'amount_min': 100
        }
        ser.my_validate(attrs)