def setup(self): user1 = User(username="******", email="*****@*****.**", first_name="john", last_name="smith") user2 = User(username="******", email="*****@*****.**", first_name="sally", last_name="smith") user1.save() user2.save() teacher1 = Teacher() teacher1.teacher = user1 teacher1.save() teacher2 = Teacher() teacher2.teacher = user2 teacher2.save() course1 = Course(teacher=teacher1, name="Intro1", position=1) course2 = Course(teacher=teacher2, name="Advanced2", position=2) course1.save() course2.save() lesson1 = Lesson(course=course1, name="Lesson1", description="Intro1 - Lesson1", position=1) lesson2 = Lesson(course=course1, name="Lesson2", description="Intro1 - Lesson2", position=2) lesson1.save() lesson2.save() slide1 = Slide(lesson=lesson1, name="Slide1", content="<h1>Slide1</h1>", position=1, googleStyles=" ") slide2 = Slide(lesson=lesson1, name="Slide2", content="<h1>Slide2</h1>", position=2, googleStyles=" ") slide1.save() slide2.save()
def test_teacher_insert(self): print "in test_teacher_insert" setup(self) self.assertEqual(Teacher.objects.count(), 2) user3 = User(username="******", email="*****@*****.**", first_name="juan", last_name="garcia") user3.save() teacher3 = Teacher() teacher3.teacher = user3 teacher3.save() self.assertEqual(Teacher.objects.count(), 3)