summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-003-event.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-07-09 17:55:18 -0400
committerThomas Bruederli <bruederli@kolabsys.com>2014-07-09 17:55:18 -0400
commit2e506e215f44a6df7299ee0a424931b95fd5062c (patch)
treeedee74fdbdf7481037f601b8a04c5c286eab3c23 /tests/unit/test-003-event.py
parent3e492389ad7f2d628134b3471bc2e4e054b7d204 (diff)
downloadpykolab-2e506e215f44a6df7299ee0a424931b95fd5062c.tar.gz
Shift event end date by one day when converting all-day events from/to iCal
Diffstat (limited to 'tests/unit/test-003-event.py')
-rw-r--r--tests/unit/test-003-event.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/unit/test-003-event.py b/tests/unit/test-003-event.py
index 81337d9..2c5a478 100644
--- a/tests/unit/test-003-event.py
+++ b/tests/unit/test-003-event.py
@@ -1,3 +1,4 @@
+import re
import datetime
import pytz
import sys
@@ -218,6 +219,25 @@ METHOD:REQUEST
self.assertEqual(parts[3]['Content-ID'].strip('<>'), attachments[0].uri()[4:])
self.assertEqual(parts[4]['Content-ID'].strip('<>'), attachments[1].uri()[4:])
+ def test_018_ical_allday_events(self):
+ ical = """BEGIN:VEVENT
+UID:ffffffff-f783-4b58-b404-b1389bd2ffff
+DTSTAMP;VALUE=DATE-TIME:20140407T122311Z
+CREATED;VALUE=DATE-TIME:20140407T122245Z
+DTSTART;VALUE=DATE:20140823
+DTEND;VALUE=DATE:20140824
+SUMMARY:All day
+DESCRIPTION:One single day
+TRANSP:OPAQUE
+CLASS:PUBLIC
+END:VEVENT
+"""
+ event = event_from_ical(ical)
+ self.assertEqual(str(event.get_start()), "2014-08-23")
+ self.assertEqual(str(event.get_end()), "2014-08-23")
+ self.assertEqual(str(event.get_ical_dtend()), "2014-08-24")
+ self.assertTrue(re.match('.*<dtend>\s*<date>2014-08-23</date>', str(event), re.DOTALL))
+
def test_019_as_string_itip(self):
self.event.set_summary("test")
self.event.set_start(datetime.datetime(2014, 05, 23, 11, 00, 00, tzinfo=pytz.timezone("Europe/London")))