Example #1
0
    def test_recurrence_cancellation_exception(self):
        cal = build_calendar(xml, FEED_LAST_UPDATE, FEED_URL)
        entries = find_entries(cal.entries, "Recurring With Cancellation")
        self.assertEquals(1, len(entries))

        e = entries[0]
        self.assertEquals(1, len(e.exceptions))

        # Check that only 4 events are returned for the week:
        start = datetime(2007, 1, 1, tzinfo=TZ)
        end = datetime(2007, 1, 8, tzinfo=TZ)
        events = e.get_events_starting_between(start, end)
        self.assertEqual(4, len(events))

        events = e.get_events_occurring_on(datetime(2007, 1, 3, tzinfo=TZ))
        self.assertEqual(0, len(events))
Example #2
0
    def test_recurring_exception_changed_time(self):
        cal = build_calendar(xml, FEED_LAST_UPDATE, FEED_URL)
        entries = find_entries(cal.entries, "Recurring With Exception")
        self.assertEqual(2, len(entries))

        # Find the parent event:
        original_event = None
        exception_event = None
        if len(entries[0].exceptions) > 0:
            self.assertEqual(0, len(entries[1].exceptions))
            original_event = entries[0]
            exception_event = entries[1]
        else:
            self.assertEqual(1, len(entries[1].exceptions))
            original_event = entries[1]
            exception_event = entries[0]

        # Check that only 4 of the 5 events are returned for the week:
        start = datetime(2006, 11, 20, tzinfo=TZ)
        end = datetime(2006, 11, 26, tzinfo=TZ)
        events = original_event.get_events_starting_between(start, end)
        self.assertEqual(4, len(events))
Example #3
0
 def test_simple_entry(self):
     cal = build_calendar(xml, FEED_LAST_UPDATE, FEED_URL)
     distant_event = find_entries(cal.entries, "Distant Event")[0]
     self.assertTrue(distant_event != None)