summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-17 22:59:48 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-17 22:59:48 +0200
commit21b33ad600d70e178eb48a9053314f58559fccfa (patch)
tree9585086733f017ed0040140c7bd92b0a4b47ea39 /tests
parent7480dafd4cf99d2ef533a9c9dd2f3b31b843d7a0 (diff)
downloadpykolab-21b33ad600d70e178eb48a9053314f58559fccfa.tar.gz
Add timezone test
Diffstat (limited to 'tests')
-rw-r--r--tests/test-005-timezone.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/test-005-timezone.py b/tests/test-005-timezone.py
new file mode 100644
index 0000000..9b12c66
--- /dev/null
+++ b/tests/test-005-timezone.py
@@ -0,0 +1,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__())
+