Exemplo n.º 1
0
    def test_course_mode_info(self):
        verified_mode = CourseModeFactory.create(
            course_id=self.course.id,
            mode_slug='verified',
            mode_display_name='Verified',
            expiration_datetime=datetime.now(pytz.UTC) + timedelta(days=1)
        )
        enrollment = CourseEnrollment.enroll(self.user, self.course.id)
        course_mode_info = complete_course_mode_info(self.course.id, enrollment)
        self.assertTrue(course_mode_info['show_upsell'])
        self.assertEquals(course_mode_info['days_for_upsell'], 1)

        verified_mode.expiration_datetime = datetime.now(pytz.UTC) + timedelta(days=-1)
        verified_mode.save()
        course_mode_info = complete_course_mode_info(self.course.id, enrollment)
        self.assertFalse(course_mode_info['show_upsell'])
        self.assertIsNone(course_mode_info['days_for_upsell'])
Exemplo n.º 2
0
    def test_course_mode_info(self):
        verified_mode = CourseModeFactory.create(
            course_id=self.course.id,
            mode_slug='verified',
            mode_display_name='Verified',
            expiration_datetime=datetime.now(pytz.UTC) + timedelta(days=1)
        )
        enrollment = CourseEnrollment.enroll(self.user, self.course.id)
        course_mode_info = complete_course_mode_info(self.course.id, enrollment)
        self.assertTrue(course_mode_info['show_upsell'])
        self.assertEquals(course_mode_info['days_for_upsell'], 1)

        verified_mode.expiration_datetime = datetime.now(pytz.UTC) + timedelta(days=-1)
        verified_mode.save()
        course_mode_info = complete_course_mode_info(self.course.id, enrollment)
        self.assertFalse(course_mode_info['show_upsell'])
        self.assertIsNone(course_mode_info['days_for_upsell'])
Exemplo n.º 3
0
 def _enrollment_with_complete_course(self, enrollment_mode):
     """"Dry method for course enrollment."""
     CourseModeFactory.create(
         course_id=self.course.id,
         mode_slug='verified',
         mode_display_name='Verified',
         expiration_datetime=datetime.now(pytz.UTC) + timedelta(days=1)
     )
     enrollment = CourseEnrollment.enroll(self.user, self.course.id, mode=enrollment_mode)
     return complete_course_mode_info(self.course.id, enrollment)
Exemplo n.º 4
0
 def _enrollment_with_complete_course(self, enrollment_mode):
     """"Dry method for course enrollment."""
     CourseModeFactory.create(
         course_id=self.course.id,
         mode_slug='verified',
         mode_display_name='Verified',
         expiration_datetime=datetime.now(pytz.UTC) + timedelta(days=1)
     )
     enrollment = CourseEnrollment.enroll(self.user, self.course.id, mode=enrollment_mode)
     return complete_course_mode_info(self.course.id, enrollment)