def test_get_student_programs(self):
     academic_year = AcademicYearFactory()
     off_year = OfferYearFactory(academic_year=academic_year)
     student = StudentFactory()
     OfferEnrollmentFactory(student=student, offer_year=off_year, enrollment_state=offer_enrollment_state.PROVISORY)
     OfferEnrollmentFactory(student=student, offer_year=off_year, enrollment_state=offer_enrollment_state.SUBSCRIBED)
     OfferEnrollmentFactory(student=student, offer_year=off_year, enrollment_state=None)
     enrollments = exam_enrollment._get_student_programs(student, academic_year)
     self.assertEqual(len(enrollments), 2)
 def test_get_one_program(self):
     self.client.force_login(self.user)
     self.assertEqual(
         exam_enrollment._get_student_programs(
             self.student, self.current_academic_year)[0],
         self.learn_unit_enrol.offer_enrollment.offer_year)
 def test_get_programs_student_is_none(self):
     self.assertIsNone(
         exam_enrollment._get_student_programs(None,
                                               self.current_academic_year))