blob: 9b12c66c5437703912472f3d3b5326913a6e907a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
import datetime
import icalendar
import pytz
import unittest
from pykolab.xml import Attendee
from pykolab.xml import Event
from pykolab.xml import EventIntegrityError
from pykolab.xml import InvalidAttendeeParticipantStatusError
from pykolab.xml import InvalidEventDateError
from pykolab.xml import event_from_ical
class TestTimezone(unittest.TestCase):
def test_001_timezone_conflict(self):
london = Event()
london.set_organizer("john.doe@example.org", "Doe, John")
london.add_attendee("resource-car-vw@example.org", cutype="RESOURCE")
london.set_start(datetime.datetime.now(pytz.timezone("Europe/London")))
london.set_end(datetime.datetime.now(pytz.timezone("Europe/London")))
zurich = Event()
zurich.set_organizer("john.doe@example.org", "Doe, John")
zurich.add_attendee("resource-car-vw@example.org", cutype="RESOURCE")
zurich.set_start(datetime.datetime.now(pytz.timezone("Europe/Zurich")))
zurich.set_end(datetime.datetime.now(pytz.timezone("Europe/Zurich")))
london_xml = london.__str__()
zurich_xml = zurich.__str__()
#print london_xml
#print zurich_xml
london_itip = london.as_string_itip()
zurich_itip = zurich.as_string_itip()
del london, zurich
#print london_itip
#print zurich_itip
london_cal = icalendar.Calendar.from_ical(london_itip)
london = event_from_ical(london_cal.walk('VEVENT')[0].to_ical())
zurich_cal = icalendar.Calendar.from_ical(zurich_itip)
zurich = event_from_ical(zurich_cal.walk('VEVENT')[0].to_ical())
self.assertEqual(london_xml, london.__str__())
self.assertEqual(zurich_xml, zurich.__str__())
|