def test_todays_date(self):
     self.setup_course_and_user()
     block = TodaysDate(self.course, self.user)
     self.assertTrue(block.is_enabled)
     self.assertEqual(block.date, datetime.now(pytz.UTC))
     self.assertEqual(block.title, 'Today is Jan 02, 2015')
     self.assertNotIn('date-summary-date', block.render())
Beispiel #2
0
 def test_todays_date(self):
     self.setup_course_and_user()
     block = TodaysDate(self.course, self.user)
     self.assertTrue(block.is_enabled)
     self.assertEqual(block.date, datetime.now(pytz.UTC))
     self.assertEqual(block.title, 'Today is Jan 02, 2015 (00:00 UTC)')
     self.assertNotIn('date-summary-date', block.render())
 def _today_date_helper(self, expected_display_date):
     """
     Helper function to test that today's date block renders correctly
     and displays the correct time, accounting for daylight savings
     """
     self.setup_course_and_user()
     set_user_preference(self.user, "time_zone", "America/Los_Angeles")
     block = TodaysDate(self.course, self.user)
     self.assertTrue(block.is_enabled)
     self.assertEqual(block.date, datetime.now(utc))
     self.assertEqual(block.title, "Today is {date}".format(date=expected_display_date))
     self.assertNotIn("date-summary-date", block.render())
Beispiel #4
0
 def _today_date_helper(self, expected_display_date):
     """
     Helper function to test that today's date block renders correctly
     and displays the correct time, accounting for daylight savings
     """
     self.setup_course_and_user()
     set_user_preference(self.user, "time_zone", "America/Los_Angeles")
     block = TodaysDate(self.course, self.user)
     self.assertTrue(block.is_enabled)
     self.assertEqual(block.date, datetime.now(utc))
     self.assertEqual(block.title,
                      'Today is {date}'.format(date=expected_display_date))
     self.assertNotIn('date-summary-date', block.render())
Beispiel #5
0
 def test_todays_date_block(self):
     """
     Helper function to test that today's date block renders correctly
     and displays the correct time, accounting for daylight savings
     """
     self.setup_course_and_user()
     block = TodaysDate(self.course, self.user)
     self.assertTrue(block.is_enabled)
     self.assertEqual(block.date, datetime.now(utc))
     self.assertEqual(block.title, 'current_datetime')
 def test_todays_date_block(self):
     """
     Helper function to test that today's date block renders correctly
     and displays the correct time, accounting for daylight savings
     """
     with freeze_time('2015-01-02'):
         course = create_course_run()
         user = create_user()
         block = TodaysDate(course, user)
         self.assertTrue(block.is_enabled)
         self.assertEqual(block.date, datetime.now(utc))
         self.assertEqual(block.title, 'current_datetime')
 def test_date_render(self):
     self.setup_course_and_user()
     block = TodaysDate(self.course, self.user)
     self.assertIn('Jan 02, 2015', block.render())
Beispiel #8
0
 def test_todays_date_render(self):
     self.setup_course_and_user()
     block = TodaysDate(self.course, self.user)
     self.assertIn('Jan 02, 2015', block.render())
 def test_todays_date_render_time_zone(self):
     self.setup_course_and_user()
     set_user_preference(self.user, "time_zone", "America/Los_Angeles")
     block = TodaysDate(self.course, self.user)
     # Today is 'Jan 01, 2015' because of time zone offset
     self.assertIn("Jan 01, 2015", block.render())
Beispiel #10
0
 def test_todays_date_render_time_zone(self):
     self.setup_course_and_user()
     set_user_preference(self.user, "time_zone", "America/Los_Angeles")
     block = TodaysDate(self.course, self.user)
     # Today is 'Jan 01, 2015' because of time zone offset
     self.assertIn('Jan 01, 2015', block.render())