def testRecurrenceEventsWhereExDateIsNotNow(self): """ Recurrence rules that have exceptions. """ # create an event starting 61 minutes ago, lasting 60 minutes, and # repeating every hour for five times; # but with an exception for the first instances now = _now() now = now.replace( microsecond=0) # recurring adjustments lose precision start = now - timedelta(minutes=61) end = now - timedelta(minutes=1) exdates = [start] rrules = [ "FREQ=HOURLY;INTERVAL=1;COUNT=5", ] calendar = Calendar() calendar.addEvent( Event('uid', start, end, 'foo', rrules=rrules, exdates=exdates)) eis = calendar.getActiveEventInstances() self.failUnless(eis) # the first event after the exception happens to start when the # exception would have ended self.assertEquals(eis[0].start, end)
def testGetActiveSimple(self): now = _now() start = now - datetime.timedelta(hours=1) end = now + datetime.timedelta(minutes=1) calendar = eventcalendar.Calendar() calendar.addEvent(eventcalendar.Event("uid", start, end, "foo")) ei = calendar.getActiveEventInstances()[0] self.assertEventAttribsEqual(ei.event, start, end, "foo", None, None)
def testGetActiveSimple(self): now = _now() start = now - timedelta(hours=1) end = now + timedelta(minutes=1) calendar = Calendar() calendar.addEvent(Event('uid', start, end, 'foo')) ei = calendar.getActiveEventInstances()[0] self.assertEventAttribsEqual(ei.event, start, end, 'foo', None, None)
def testRecurrenceEventsWhereExDateIsStartDate(self): """ Recurrence rules that have exceptions. """ now = _now() now = now.replace(microsecond=0) # recurring adjustments lose precision start = now - datetime.timedelta(minutes=61) end = now - datetime.timedelta(minutes=1) exdates = [start] rrules = ["FREQ=HOURLY;INTERVAL=1;COUNT=5"] calendar = eventcalendar.Calendar() calendar.addEvent(eventcalendar.Event("uid", start, end, "foo", rrules=rrules, exdates=exdates)) eis = calendar.getActiveEventInstances(start) self.failIf(eis)
def testRecurrenceEventsWhereExDateIsStartDate(self): """ Recurrence rules that have exceptions. """ now = _now() now = now.replace( microsecond=0) # recurring adjustments lose precision start = now - timedelta(minutes=61) end = now - timedelta(minutes=1) exdates = [start] rrules = [ "FREQ=HOURLY;INTERVAL=1;COUNT=5", ] calendar = Calendar() calendar.addEvent( Event('uid', start, end, 'foo', rrules=rrules, exdates=exdates)) eis = calendar.getActiveEventInstances(start) self.failIf(eis)
def testRecurrenceEventsWhereExDateIsNotNow(self): """ Recurrence rules that have exceptions. """ # create an event starting 61 minutes ago, lasting 60 minutes, and # repeating every hour for five times; # but with an exception for the first instances now = _now() now = now.replace(microsecond=0) # recurring adjustments lose precision start = now - datetime.timedelta(minutes=61) end = now - datetime.timedelta(minutes=1) exdates = [start] rrules = ["FREQ=HOURLY;INTERVAL=1;COUNT=5"] calendar = eventcalendar.Calendar() calendar.addEvent(eventcalendar.Event("uid", start, end, "foo", rrules=rrules, exdates=exdates)) eis = calendar.getActiveEventInstances() self.failUnless(eis) # the first event after the exception happens to start when the # exception would have ended self.assertEquals(eis[0].start, end)