Exemple #1
0
    def test_not_visible_when_no_enrollment_exists(self):
        self.enrollment.delete()

        request = RequestFactory().request()
        request.user = UserFactory()
        self.assertFalse(VerifiedUpgradeTool().is_enabled(
            self.request, self.course.id))
Exemple #2
0
 def test_not_visible_when_no_verified_track(self):
     self.course_verified_mode.delete()
     self.assertFalse(VerifiedUpgradeTool().is_enabled(
         self.request, self.course.id))
Exemple #3
0
 def test_not_visible_when_already_verified(self):
     self.enrollment.mode = CourseMode.VERIFIED
     self.enrollment.save()
     self.assertFalse(VerifiedUpgradeTool().is_enabled(
         self.request, self.course.id))
Exemple #4
0
 def test_not_visible_when_enrollment_is_inactive(self):
     self.enrollment.is_active = False
     self.enrollment.save()
     self.assertFalse(VerifiedUpgradeTool().is_enabled(
         self.request, self.course.id))
Exemple #5
0
 def test_not_visible_when_using_deadline_from_course_mode(self):
     DynamicUpgradeDeadlineConfiguration.objects.create(enabled=False)
     self.assertFalse(VerifiedUpgradeTool().is_enabled(
         self.request, self.course.id))
Exemple #6
0
 def test_tool_visible(self):
     self.assertTrue(VerifiedUpgradeTool().is_enabled(
         self.request, self.course.id))
Exemple #7
0
 def test_not_visible_when_course_mode_has_no_deadline(self):
     self.course_verified_mode.expiration_datetime = None
     self.course_verified_mode.save()
     self.assertFalse(VerifiedUpgradeTool().is_enabled(
         self.request, self.course.id))
Exemple #8
0
 def test_not_visible_when_course_deadline_has_passed(self):
     self.course_verified_mode.expiration_datetime = self.now - datetime.timedelta(
         days=1)
     self.course_verified_mode.save()
     self.assertFalse(VerifiedUpgradeTool().is_enabled(
         self.request, self.course.id))