Esempio n. 1
0
 def items(self):
     return [{
         'title': 'Title1',
         'description': 'Description1',
         'link': '/event/1',
         'start': datetime(2012, 5, 1, 18, 00),
         'end': datetime(2012, 5, 1, 20, 00),
         'geolocation': (37.386013, -122.082932),
         'rrule': build_rrule(freq='WEEKLY', until=datetime.now(), wkst='SU', byday='MO,TU'),
         'organizer': '*****@*****.**',
     }, {
         'title': 'Title2',
         'description': 'Description2',
         'link': '/event/2',
         'start': datetime(2012, 5, 6, 18, 00),
         'end': datetime(2012, 5, 6, 20, 00),
         'geolocation': (37.386013, -122.082932),
         'rrule': build_rrule(freq='WEEKLY', until=datetime.now(), wkst='MO', byday='MO,TU,WE'),
         'organizer': {
             'cn': 'John Doe',
             'email': '*****@*****.**',
             'role': 'CHAIR'
         },
     }]
Esempio n. 2
0
    def test_parse_rrule_all_values(self):
        rrule = build_rrule(
            count=1,
            interval=2,
            bysecond=3,
            byminute=4,
            byhour=5,
            byweekno=6,
            bymonthday=7,
            byyearday=8,
            bymonth=9,
            until=datetime(2015, 1, 13, 14, 15, 16),
            bysetpos=10,
            wkst='MO',
            byday='TU',
            freq='WEEKLY',
        )

        # expected length
        self.assertEqual(len(rrule), 14)
        # testing that function created keys for each key in vRecur:
        self.assertEqual(sorted(rrule.keys()), sorted(vRecur.types.keys()))
        #expected values:
        self.assertEqual(rrule['COUNT'], 1)
        self.assertEqual(rrule['INTERVAL'], 2)
        self.assertEqual(rrule['BYSECOND'], 3)
        self.assertEqual(rrule['BYMINUTE'], 4)
        self.assertEqual(rrule['BYHOUR'], 5)
        self.assertEqual(rrule['BYWEEKNO'], 6)
        self.assertEqual(rrule['BYMONTHDAY'], 7)
        self.assertEqual(rrule['BYYEARDAY'], 8)
        self.assertEqual(rrule['BYMONTH'], 9)
        self.assertEqual(rrule['UNTIL'], datetime(2015, 1, 13, 14, 15, 16))
        self.assertEqual(rrule['BYSETPOS'], 10)
        self.assertEqual(rrule['WKST'], 'MO')
        self.assertEqual(rrule['BYDAY'], 'TU')
        self.assertEqual(rrule['FREQ'], 'WEEKLY')
Esempio n. 3
0
 def test_parse_rrule_freq_invalid(self):
     try:
         build_rrule(freq='invalid')
         self.fail('Value error was expected')
     except ValueError:
         pass
Esempio n. 4
0
 def test_parse_rrule_empty(self):
     self.assertEqual(build_rrule(), {})