diff options
-rw-r--r-- | tests.py | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -16,14 +16,17 @@ from django.test import TestCase from django.utils import timezone -from .models import Course, Group, Timetable +from .models import Course, Group, Timetable, Year class CourseTestCase(TestCase): def setUp(self): dt = timezone.now() - self.timetable = Timetable(name="Test timetable 2", url="http://example.org/", slug="test-timetable2") + self.year = Year(name="L2", slug="l2") + self.year.save() + + self.timetable = Timetable(year=self.year, name="Test timetable 2", url="http://example.org/", slug="test-timetable2") self.timetable.save() cma = Group.objects.create(celcat_name="L1 info s2 CMA", timetable=self.timetable) @@ -53,7 +56,10 @@ class CourseTestCase(TestCase): class GroupTestCase(TestCase): def setUp(self): - self.timetable = Timetable(name="Test timetable", url="http://example.com/", slug="test-timetable") + self.year = Year(name="L1", slug="l1") + self.year.save() + + self.timetable = Timetable(year=self.year, name="Test timetable", url="http://example.com/", slug="test-timetable") self.timetable.save() Group.objects.create(celcat_name="L1 info s2 CMA", timetable=self.timetable) |