Esempio n. 1
0
    def test_clean_failure(self):
        course2 = factories.CourseFactory(identifier="another-course")
        participation3 = factories.ParticipationFactory(course=course2,
                                                        user=self.user2)

        et2 = models.ExamTicket(exam=self.exam,
                                participation=participation3,
                                code="cdef")

        with self.assertRaises(ValidationError) as cm:
            et2.clean()

        expected_error_msg = ("Participation and exam must live "
                              "in the same course")
        self.assertIn(expected_error_msg, str(cm.exception))
Esempio n. 2
0
 def test_clean_no_participation(self):
     et1 = models.ExamTicket(exam=self.exam,
                             participation=None,
                             code="abcd")
     et1.clean()