示例#1
0
    def test_time_equal_to_end_time(self):
        start_date = datetime(2006, 8, 1, 8, 42, 0, tzinfo=TZ)
        end_date = datetime(2007, 8, 1, 8, 42, 0, tzinfo=TZ)

        current_event = SingleOccurrenceEntry("fakeId", TITLE,
            DESCRIPTION, REMIND, UPDATED, end_date, 812, LOCATION, self.cal)

        self.assertEqual(1, len(current_event.get_events_starting_between(
            start_date, end_date)))
示例#2
0
    def test_occurring_on_with_all_day_event(self):
        """
        Test an all-day event is returned for a call to occuring on.
        """
        time = datetime(2006, 10, 28, tzinfo=TZ)
        all_day = SingleOccurrenceEntry("fakeId", TITLE, DESCRIPTION,
            REMIND, UPDATED, time, 86400, LOCATION, self.cal)

        events = all_day.get_events_occurring_on(time)
        self.assertEquals(1, len(events))
示例#3
0
    def test_occurring_on_all_day_event_tomorrow(self):
        """
        Test that an all day event is not returned when querying the previous
        day.
        """
        time = datetime(2006, 10, 28, tzinfo=TZ)
        all_day = SingleOccurrenceEntry("fakeId", TITLE, DESCRIPTION,
            REMIND, UPDATED, time, 86400, LOCATION, self.cal)

        events = all_day.get_events_occurring_on(time - timedelta(days=1))
        self.assertEquals(0, len(events))
示例#4
0
    def test_event_within_end_time(self):
        time = datetime(2015, 05, 23, 22, 0, 0, tzinfo=TZ)
        end_date = datetime(2020, 01, 01, tzinfo=TZ)

        distant_event = SingleOccurrenceEntry("fakeId", TITLE, DESCRIPTION,
            REMIND, UPDATED, time, 3600, LOCATION, self.cal)

        events = distant_event.get_events_starting_between(None, end_date)
        self.assertEquals(1, len(events))

        self.assertEquals(time, events[0].time)
        self.assertEquals(3600, events[0].entry.duration)
示例#5
0
    def test_occurring_on_with_multi_day_event(self):
        """
        Test a multi-day event that starts before and ends after the date
        queried.
        """
        query_date = datetime(2006, 10, 26, tzinfo=TZ)
        event_start = datetime(2006, 10, 20, tzinfo=TZ)
        event_duration = 60 * 60 * 24 * 14 # two weeks

        vacation = SingleOccurrenceEntry("fakeId", TITLE, DESCRIPTION,
            REMIND, UPDATED, event_start, event_duration, LOCATION, self.cal)

        events = vacation.get_events_occurring_on(query_date)
        self.assertEquals(1, len(events))