def test_start_date_alert(self, current_time, expected_message_html):
     """
     Verify that course start date alerts are registered.
     """
     with freeze_time(current_time):
         block = CourseStartDate(self.course, self.request.user)
         block.register_alerts(self.request, self.course)
         messages = list(CourseHomeMessages.user_messages(self.request))
         if expected_message_html:
             self.assertEqual(len(messages), 1)
             self.assertIn(expected_message_html, messages[0].message_html)
         else:
             self.assertEqual(len(messages), 0)
 def test_start_date_alert(self, current_time, expected_message_html):
     """
     Verify that course start date alerts are registered.
     """
     with freeze_time(current_time):
         block = CourseStartDate(self.course, self.request.user)
         block.register_alerts(self.request, self.course)
         messages = list(CourseHomeMessages.user_messages(self.request))
         if expected_message_html:
             self.assertEqual(len(messages), 1)
             self.assertIn(expected_message_html, messages[0].message_html)
         else:
             self.assertEqual(len(messages), 0)
 def test_course_start_date(self):
     course = create_course_run()
     user = create_user()
     block = CourseStartDate(course, user)
     self.assertEqual(block.date, course.start)
Beispiel #4
0
 def test_course_start_date(self):
     self.setup_course_and_user()
     block = CourseStartDate(self.course, self.user)
     self.assertEqual(block.date, self.course.start)
Beispiel #5
0
 def test_start_date_render(self):
     self.setup_course_and_user()
     block = CourseStartDate(self.course, self.user)
     self.assertIn('in 1 day - Jan 03, 2015', block.render())
 def test_start_date_render_time_zone(self):
     self.setup_course_and_user()
     set_user_preference(self.user, "time_zone", "America/Los_Angeles")
     block = CourseStartDate(self.course, self.user)
     # Jan 02 is in 1 day because of time zone offset
     self.assertIn("in 1 day - Jan 02, 2015", block.render())
 def test_start_date_render(self):
     self.setup_course_and_user()
     block = CourseStartDate(self.course, self.user)
     self.assertIn("in 1 day - Jan 03, 2015", block.render())
Beispiel #8
0
 def test_start_date_render_time_zone(self):
     self.setup_course_and_user()
     set_user_preference(self.user, "time_zone", "America/Los_Angeles")
     block = CourseStartDate(self.course, self.user)
     # Jan 02 is in 1 day because of time zone offset
     self.assertIn('in 1 day - Jan 02, 2015', block.render())