summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-18 12:01:01 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-18 12:01:01 +0100
commitede89aab8d5eac1d8173347b22c3cc408d1aff39 (patch)
tree7551138e3e42b1d4d3b8d3466409f7e437bdfb20 /tests
parente389b12b4deb578ea2e57c50a24f47afc8a07981 (diff)
downloadpykolab-ede89aab8d5eac1d8173347b22c3cc408d1aff39.tar.gz
Update timezone test
Diffstat (limited to 'tests')
-rw-r--r--tests/test-005-timezone.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/tests/test-005-timezone.py b/tests/test-005-timezone.py
index 9b12c66..8110e30 100644
--- a/tests/test-005-timezone.py
+++ b/tests/test-005-timezone.py
@@ -1,5 +1,6 @@
import datetime
import icalendar
+import os
import pytz
import unittest
@@ -13,17 +14,23 @@ from pykolab.xml import event_from_ical
class TestTimezone(unittest.TestCase):
def test_001_timezone_conflict(self):
+ #class datetime.timedelta([days[, seconds[, microseconds[, milliseconds[, minutes[, hours[, weeks]]]]]]])
+ tdelta = datetime.timedelta(0, 0, 0, 0, 0, 1)
+
+ event_start = datetime.datetime.now(pytz.timezone("UTC"))
+ event_end = datetime.datetime.now(pytz.timezone("UTC")) + tdelta
+
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")))
+ london.set_start(event_start.replace(tzinfo=pytz.timezone("Europe/London")))
+ london.set_end(event_end.replace(tzinfo=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")))
+ zurich.set_start(event_start.replace(tzinfo=pytz.timezone("Europe/Zurich")))
+ zurich.set_end(event_end.replace(tzinfo=pytz.timezone("Europe/Zurich")))
london_xml = london.__str__()
zurich_xml = zurich.__str__()
@@ -45,6 +52,22 @@ class TestTimezone(unittest.TestCase):
zurich_cal = icalendar.Calendar.from_ical(zurich_itip)
zurich = event_from_ical(zurich_cal.walk('VEVENT')[0].to_ical())
+ #fp = open(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'event-london1')), 'w')
+ #fp.write(london_xml)
+ #fp.close()
+
+ #fp = open(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'event-london2')), 'w')
+ #fp.write(london.__str__())
+ #fp.close()
+
+ #fp = open(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'event-zurich1')), 'w')
+ #fp.write(zurich_xml)
+ #fp.close()
+
+ #fp = open(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'event-zurich2')), 'w')
+ #fp.write(zurich.__str__())
+ #fp.close()
+
self.assertEqual(london_xml, london.__str__())
self.assertEqual(zurich_xml, zurich.__str__())