def testRecurringExceptionLast(self): calendarfile = os.path.join(self.cwd, 'resources/recurring_exception_last.ics') startdate, enddate = self.getStartAndEndtime('20170103') enddate = enddate + timedelta(days=1) calendar = Calendar2Events(calendarfile, None, None, startdate, enddate, 'ADNOVUM') events = calendar.fetchCalendarEvents() events.sort(key=lambda k: k.startdatetime) self.assertEqual( len(events), 2, 'There are differences in the number of calendar items found for the specified date range' ) self.assertEqual('03-01-2017 14:00:00', events[0].getStartDateTimeString(), 'Difference in start date (first)') self.assertEqual('14:30', events[0].getEndTimeString(), 'Difference in start date (first)') self.assertEqual('04-01-2017 14:15:00', events[1].getStartDateTimeString(), 'Difference in start date (second)') self.assertEqual('14:45', events[1].getEndTimeString(), 'Difference in start date (second)')
def testNoEventsFoundParsing(self): calendar = Calendar2Events(self.calendarfile, None, None, self.startdate4, self.enddate4, 'ADNOVUM') events = calendar.fetchCalendarEvents() self.assertEqual( len(events), 0, 'There are differences in the number of calendar items found for the specified date range (' + self.startdate4.strftime('%Y-%m-%d') + ',' + self.enddate4.strftime('%Y-%m-%d') + ')')
def testRecurringEventParsing(self): calendar = Calendar2Events(self.calendarfile, None, None, self.startdate3, self.enddate4, 'ADNOVUM') events = calendar.fetchCalendarEvents() self.assertEqual( len(events), 4, 'There are differences in the number of calendar items found for the specified date range (' + self.startdate3.strftime('%Y-%m-%d') + ',' + self.enddate4.strftime('%Y-%m-%d') + ')') for ev in events: self.assertEqual('Daily Sync', ev.comment, 'Differences in comments') self.assertEqual('UBS STMP.Wave_25:meet_int', ev.contract, 'Differences in contract')
def testRecurring(self): calendarfile = os.path.join(self.cwd, 'resources/recurring.ics') startdate, enddate = self.getStartAndEndtime('20161004') enddate = enddate #+ timedelta(days=1) calendar = Calendar2Events(calendarfile, None, None, startdate, enddate, 'ADNOVUM') events = calendar.fetchCalendarEvents() self.assertEqual( len(events), 1, 'There are differences in the number of calendar items found for the specified date range' ) for ev in events: self.assertEqual('Scrum Sync', ev.comment, 'Differences in comments') self.assertEqual('UBS STMP.Wave_26:meet_int', ev.contract, 'Differences in contract') self.assertEqual('04-10-2016 14:00:00', ev.getStartDateTimeString(), 'Difference in start date') self.assertEqual('14:30', ev.getEndTimeString(), 'Difference in start date')
def __getITCEvents(self): """ Parses all defined calendars and returns a list of events having ITC information. :return: a list of calendarEvent """ calendarEvents = [] calendars = self.config.get('Config', 'calendars') for cal in calendars.split(','): self.__log.debug('Parsing Calendar {0}'.format(cal)) calendarurl = self.config.get(cal, 'url') calendarpass, calendaruser = self.__parseCalendarCredentials(cal) configjiraname = 'ADNOVUM' if self.config.has_option(cal, 'jiraname'): configjiraname = self.config.get(cal, 'jiraname') c = Calendar2Events(calendarurl, calendaruser, calendarpass, self.startdate, self.enddate, self.__verifySSL) events = c.fetchCalendarEvents() events.sort(key=lambda k: k.startdatetime) #self.__logEvents(events) calendarEvents.extend(events) calendarEvents.sort(key=lambda k: k.startdatetime) return calendarEvents