def test_occurrences_after_with_events_before_returns_empty(self): calendar = Calendar() calendar.save() start_after = timezone.now() + datetime.timedelta(days=-1) end_after = start_after + datetime.timedelta(hours=1) event = self.__create_event(start_after, end_after) calendar.events.add(event) occurrences = list(calendar.occurrences_after(timezone.now())) self.assertEqual(occurrences, [])
def test_occurrences_after_with_events_after_returns_events(self): calendar = Calendar() calendar.save() start_after = timezone.now() + datetime.timedelta(days=1) end_after = start_after + datetime.timedelta(hours=1) event = self.__create_event(start_after, end_after) calendar.events.add(event) occurrences = list(calendar.occurrences_after(timezone.now())) self.assertEquals(len(occurrences), 1) self.assertEquals(occurrences[0].start, start_after) self.assertEquals(occurrences[0].end, end_after)
def test_occurrences_after_without_events_is_empty(self): calendar = Calendar() self.assertEqual(list(calendar.occurrences_after(timezone.now())), [])