summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-003-event.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-02-17 09:43:42 +0100
committerThomas Bruederli <bruederli@kolabsys.com>2015-02-17 09:43:42 +0100
commite25e91e5c23621c53e1c0034cf5d3c42e939363e (patch)
tree5079352a25e9825c7281b5833bb237f02fccfa39 /tests/unit/test-003-event.py
parent28cff75a01981c596051129e7b7f5f3a14781d62 (diff)
downloadpykolab-e25e91e5c23621c53e1c0034cf5d3c42e939363e.tar.gz
Add utility methods to update attendees with propagation to recurrence exceptions
Diffstat (limited to 'tests/unit/test-003-event.py')
-rw-r--r--tests/unit/test-003-event.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unit/test-003-event.py b/tests/unit/test-003-event.py
index 042d56a..1d0ad10 100644
--- a/tests/unit/test-003-event.py
+++ b/tests/unit/test-003-event.py
@@ -404,6 +404,13 @@ class TestEventXML(unittest.TestCase):
def test_009_invalid_participant_status(self):
self.assertRaises(InvalidAttendeeParticipantStatusError, self.event.set_attendee_participant_status, "jane@doe.org", "INVALID")
+ def test_009_update_attendees(self):
+ jane = self.event.get_attendee("jane@doe.org")
+ jane.set_name("Jane (GI) Doe")
+ self.event.update_attendees([jane])
+ self.assertEqual(len(self.event.get_attendees()), 2)
+ self.assertEqual(self.event.get_attendee("jane@doe.org").get_name(), "Jane (GI) Doe")
+
def test_010_datetime_from_string(self):
self.assertRaises(InvalidEventDateError, self.event.set_start, "2012-05-23 11:58:00")
@@ -842,6 +849,23 @@ END:VEVENT
self.assertEqual(property_to_string('attach', data['attach'][0]), "noname.1395223627.5555")
+ def test_027_merge_attendee_data(self):
+ event = event_from_string(xml_event)
+
+ jane = event.get_attendee("jane@example.org")
+ jane.set_participant_status('TENTATIVE')
+ jack = Attendee("jack@example.org", name="Jack", role='OPT-PARTICIPANT')
+
+ # update jane + add jack
+ event.update_attendees([jane,jack])
+ self.assertEqual(len(event.get_attendees()), 3)
+ self.assertEqual(event.get_attendee("jane@example.org").get_participant_status(), kolabformat.PartTentative)
+
+ exception = event.get_exceptions()[0]
+ self.assertEqual(len(exception.get_attendees()), 2)
+ self.assertEqual(event.get_attendee("jane@example.org").get_participant_status(), kolabformat.PartTentative)
+ self.assertEqual(event.get_attendee("jack@example.org").get_name(), "Jack")
+
def _find_prop_in_list(self, diff, name):
for prop in diff:
if prop['property'] == name: