test_signals_post_create.py 916 Bytes
Newer Older
1 2
from django.test import TestCase

3
from base_app.models import User
Florent Chehab's avatar
Florent Chehab committed
4
from backend_app.models.user import UserData
5

Florent Chehab's avatar
Florent Chehab committed
6 7 8
from backend_app.models.university import University
from backend_app.models.university import UniversityInfo
from backend_app.models.university import UniversitySemestersDates
9 10 11 12 13


class AutomaticCreationPostCreateTestCase(TestCase):
    @classmethod
    def setUpTestData(cls):
14
        cls.user = User.objects.create_user(username="toto")
15

16
        cls.univ = University.objects.create(name="Univ de test", utc_id=1000)
17 18

    def test_user_data_automatically_created(self):
19
        self.assertTrue(UserData.objects.filter(owner=self.user).exists())
20 21

    def test_univ_data_automatically_created(self):
22
        self.assertTrue(UniversityInfo.objects.filter(university=self.univ).exists())
23
        self.assertTrue(
24
            UniversitySemestersDates.objects.filter(university=self.univ).exists()
25
        )