Example #1
0
 def test_render_date_string_past(self, delta, expected_date_string):
     self.setup_course_and_user(
         days_till_start=-10,
         verification_status='denied',
         days_till_verification_deadline=delta,
     )
     block = VerificationDeadlineDate(self.course, self.user)
     self.assertEqual(block.get_context()['date'], expected_date_string)
Example #2
0
 def test_render_date_string_time_zone(self, delta, expected_date_string):
     self.setup_course_and_user(
         days_till_start=-10,
         verification_status='denied',
         days_till_verification_deadline=delta,
     )
     set_user_preference(self.user, "time_zone", "America/Los_Angeles")
     block = VerificationDeadlineDate(self.course, self.user)
     self.assertEqual(block.get_context()['date'], expected_date_string)
    def test_render_date_string_past(self, delta, expected_date_string):
        with freeze_time('2015-01-02'):
            course = create_course_run(days_till_start=-10, days_till_verification_deadline=delta)
            user = create_user(verification_status='denied')
            CourseEnrollmentFactory(course_id=course.id, user=user, mode=CourseMode.VERIFIED)

            block = VerificationDeadlineDate(course, user)
            self.assertEqual(block.relative_datestring, expected_date_string)
Example #4
0
 def test_no_verified_enrollment(self):
     course = create_course_run(days_till_start=-1)
     user = create_user()
     CourseEnrollmentFactory(course_id=course.id,
                             user=user,
                             mode=CourseMode.AUDIT)
     block = VerificationDeadlineDate(course, user)
     self.assertFalse(block.is_enabled)
Example #5
0
 def test_render_date_string_past(self, delta, expected_date_string):
     with freeze_time('2015-01-02'):
         self.setup_course_and_user(
             days_till_start=-10,
             verification_status='denied',
             days_till_verification_deadline=delta,
         )
         block = VerificationDeadlineDate(self.course, self.user)
         self.assertEqual(block.relative_datestring, expected_date_string)
Example #6
0
 def test_no_verification_deadline(self):
     course = create_course_run(days_till_start=-1,
                                days_till_verification_deadline=None)
     user = self.create_user()
     CourseEnrollmentFactory(course_id=course.id,
                             user=user,
                             mode=CourseMode.VERIFIED)
     block = VerificationDeadlineDate(course, user)
     self.assertFalse(block.is_enabled)
Example #7
0
 def test_verification_deadline_date_retry(self):
     self.setup_course_and_user(days_till_start=-1, verification_status='denied')
     block = VerificationDeadlineDate(self.course, self.user)
     self.assertEqual(block.css_class, 'verification-deadline-retry')
     self.assertEqual(block.title, 'Verification Deadline')
     self.assertEqual(block.date, datetime.now(utc) + timedelta(days=14))
     self.assertEqual(
         block.description,
         'You must successfully complete verification before this date to qualify for a Verified Certificate.'
     )
     self.assertEqual(block.link_text, 'Retry Verification')
     self.assertEqual(block.link, reverse('verify_student_reverify'))
Example #8
0
 def test_verification_deadline_date_upcoming(self):
     self.setup_course_and_user(days_till_start=-1)
     block = VerificationDeadlineDate(self.course, self.user)
     self.assertEqual(block.css_class, 'verification-deadline-upcoming')
     self.assertEqual(block.title, 'Verification Deadline')
     self.assertEqual(block.date, datetime.now(utc) + timedelta(days=14))
     self.assertEqual(
         block.description,
         'You must successfully complete verification before this date to qualify for a Verified Certificate.'
     )
     self.assertEqual(block.link_text, 'Verify My Identity')
     self.assertEqual(block.link, reverse('verify_student_verify_now', args=(self.course.id,)))
    def test_verification_deadline_date_denied(self):
        with freeze_time('2015-01-02'):
            course = create_course_run(days_till_start=-10, days_till_verification_deadline=-1)
            user = create_user(verification_status='denied')
            CourseEnrollmentFactory(course_id=course.id, user=user, mode=CourseMode.VERIFIED)

            block = VerificationDeadlineDate(course, user)
            self.assertEqual(block.css_class, 'verification-deadline-passed')
            self.assertEqual(block.title, 'Missed Verification Deadline')
            self.assertEqual(block.date, datetime.now(utc) + timedelta(days=-1))
            self.assertEqual(
                block.description,
                "Unfortunately you missed this course's deadline for a successful verification."
            )
            self.assertEqual(block.link_text, 'Learn More')
            self.assertEqual(block.link, '')
    def test_verification_deadline_date_retry(self):
        with freeze_time('2015-01-02'):
            course = create_course_run(days_till_start=-1)
            user = create_user(verification_status='denied')
            CourseEnrollmentFactory(course_id=course.id, user=user, mode=CourseMode.VERIFIED)

            block = VerificationDeadlineDate(course, user)
            self.assertEqual(block.css_class, 'verification-deadline-retry')
            self.assertEqual(block.title, 'Verification Deadline')
            self.assertEqual(block.date, datetime.now(utc) + timedelta(days=14))
            self.assertEqual(
                block.description,
                'You must successfully complete verification before this date to qualify for a Verified Certificate.'
            )
            self.assertEqual(block.link_text, 'Retry Verification')
            self.assertEqual(block.link, reverse('verify_student_reverify'))
Example #11
0
 def test_verification_deadline_date_denied(self):
     self.setup_course_and_user(
         days_till_start=-10,
         verification_status='denied',
         days_till_verification_deadline=-1,
     )
     block = VerificationDeadlineDate(self.course, self.user)
     self.assertEqual(block.css_class, 'verification-deadline-passed')
     self.assertEqual(block.title, 'Missed Verification Deadline')
     self.assertEqual(block.date, datetime.now(utc) + timedelta(days=-1))
     self.assertEqual(
         block.description,
         "Unfortunately you missed this course's deadline for a successful verification."
     )
     self.assertEqual(block.link_text, 'Learn More')
     self.assertEqual(block.link, '')
Example #12
0
 def test_no_verified_enrollment(self):
     self.setup_course_and_user(days_till_start=-1,
                                enrollment_mode=CourseMode.AUDIT)
     block = VerificationDeadlineDate(self.course, self.user)
     self.assertFalse(block.is_enabled)
Example #13
0
 def test_no_verification_deadline(self):
     self.setup_course_and_user(days_till_start=-1,
                                days_till_verification_deadline=None)
     block = VerificationDeadlineDate(self.course, self.user)
     self.assertFalse(block.is_enabled)