summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-003-event.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-08-06 12:39:22 -0400
committerThomas Bruederli <bruederli@kolabsys.com>2014-08-06 12:39:22 -0400
commit9febaa9596bff65c25f81688283fbf5940a4bdef (patch)
treeb3cb6f02eac7717736dd47fa2f439bfacda47cfb /tests/unit/test-003-event.py
parent9151feafa799c0795845f2a020d38da4f45b4437 (diff)
downloadpykolab-9febaa9596bff65c25f81688283fbf5940a4bdef.tar.gz
Fix iTip REPLY when an attendee delegated to another: both attendees shall be listed (RFC 5546, Section 3.2.2.3.)
Diffstat (limited to 'tests/unit/test-003-event.py')
-rw-r--r--tests/unit/test-003-event.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/unit/test-003-event.py b/tests/unit/test-003-event.py
index 1f54419..4736b19 100644
--- a/tests/unit/test-003-event.py
+++ b/tests/unit/test-003-event.py
@@ -428,6 +428,42 @@ END:VEVENT
self.assertEqual(event['X-CUSTOM'], "check")
self.assertIsInstance(event['dtstamp'].dt, datetime.datetime)
+ def test_019_to_message_itip(self):
+ self.event = Event()
+ self.event.set_summary("test")
+ self.event.set_start(datetime.datetime(2014, 05, 23, 11, 00, 00, tzinfo=pytz.timezone("Europe/London")))
+ self.event.set_end(datetime.datetime(2014, 05, 23, 12, 30, 00, tzinfo=pytz.timezone("Europe/London")))
+ self.event.set_organizer("me@kolab.org")
+ self.event.add_attendee("john@doe.org")
+ self.event.add_attendee("jane@doe.org")
+
+ message = self.event.to_message_itip("john@doe.org", method="REPLY", participant_status="ACCEPTED")
+ itip_event = None
+ for part in message.walk():
+ if part.get_content_type() == "text/calendar":
+ ical = icalendar.Calendar.from_ical(part.get_payload(decode=True))
+ itip_event = ical.walk('VEVENT')[0]
+ break
+
+ self.assertEqual(itip_event['uid'], self.event.get_uid())
+ self.assertEqual(itip_event['attendee'].lower(), 'mailto:john@doe.org')
+
+ # delegate jane => jack
+ self.event.delegate("jane@doe.org", "jack@ripper.com", "Jack")
+
+ message = self.event.to_message_itip("jane@doe.org", method="REPLY", participant_status="DELEGATED")
+ itip_event = None
+ for part in message.walk():
+ if part.get_content_type() == "text/calendar":
+ ical = icalendar.Calendar.from_ical(part.get_payload(decode=True))
+ itip_event = ical.walk('VEVENT')[0]
+ break
+
+ self.assertEqual(len(itip_event['attendee']), 2)
+ self.assertEqual(itip_event['attendee'][0].lower(), 'mailto:jane@doe.org')
+ self.assertEqual(itip_event['attendee'][1].lower(), 'mailto:jack@ripper.com')
+
+
def test_020_calendaring_recurrence(self):
rrule = kolabformat.RecurrenceRule()
rrule.setFrequency(kolabformat.RecurrenceRule.Monthly)