diff options
Diffstat (limited to 'tests/functional')
-rw-r--r-- | tests/functional/test_wallace/test_005_resource_invitation.py | 18 | ||||
-rw-r--r-- | tests/functional/test_wallace/test_007_invitationpolicy.py | 27 |
2 files changed, 25 insertions, 20 deletions
diff --git a/tests/functional/test_wallace/test_005_resource_invitation.py b/tests/functional/test_wallace/test_005_resource_invitation.py index 946cb5f..d9f2d41 100644 --- a/tests/functional/test_wallace/test_005_resource_invitation.py +++ b/tests/functional/test_wallace/test_005_resource_invitation.py @@ -8,6 +8,7 @@ import uuid from pykolab.imap import IMAP from wallace import module_resources +from pykolab.xml import event_from_message from email import message_from_string from twisted.trial import unittest @@ -23,7 +24,7 @@ CALSCALE:GREGORIAN METHOD:REQUEST BEGIN:VEVENT UID:%s -DTSTAMP:20140213T1254140 +DTSTAMP:20140213T125414Z DTSTART;TZID=Europe/London:%s DTEND;TZID=Europe/London:%s SUMMARY:test @@ -43,7 +44,7 @@ CALSCALE:GREGORIAN METHOD:REQUEST BEGIN:VEVENT UID:%s -DTSTAMP:20140215T1254140 +DTSTAMP:20140215T125414Z DTSTART;TZID=Europe/London:%s DTEND;TZID=Europe/London:%s SEQUENCE:2 @@ -90,7 +91,7 @@ CALSCALE:GREGORIAN METHOD:CANCEL BEGIN:VEVENT UID:%s -DTSTAMP:20140218T1254140 +DTSTAMP:20140218T125414Z DTSTART;TZID=Europe/London:20120713T100000 DTEND;TZID=Europe/London:20120713T110000 SUMMARY:test @@ -112,7 +113,7 @@ CALSCALE:GREGORIAN METHOD:REQUEST BEGIN:VEVENT UID:%s -DTSTAMP:20140213T1254140 +DTSTAMP:20140213T125414Z DTSTART;VALUE=DATE:%s DTEND;VALUE=DATE:%s SUMMARY:test @@ -133,7 +134,7 @@ CALSCALE:GREGORIAN METHOD:REQUEST BEGIN:VEVENT UID:%s -DTSTAMP:20140213T1254140 +DTSTAMP:20140213T125414Z DTSTART;TZID=Europe/Zurich:%s DTEND;TZID=Europe/Zurich:%s RRULE:FREQ=WEEKLY;INTERVAL=1;COUNT=10 @@ -328,12 +329,7 @@ class TestResourceInvitation(unittest.TestCase): if uid and event_message['subject'] != uid: continue - for part in event_message.walk(): - if part.get_content_type() == "application/calendar+xml": - payload = part.get_payload(decode=True) - found = pykolab.xml.event_from_string(payload) - break - + found = event_from_message(event_message) if found: break diff --git a/tests/functional/test_wallace/test_007_invitationpolicy.py b/tests/functional/test_wallace/test_007_invitationpolicy.py index 4fd61a7..3b68aef 100644 --- a/tests/functional/test_wallace/test_007_invitationpolicy.py +++ b/tests/functional/test_wallace/test_007_invitationpolicy.py @@ -11,6 +11,7 @@ from pykolab.imap import IMAP from wallace import module_resources from pykolab.translate import _ +from pykolab.xml import event_from_message from email import message_from_string from twisted.trial import unittest @@ -26,7 +27,7 @@ CALSCALE:GREGORIAN METHOD:REQUEST BEGIN:VEVENT UID:%(uid)s -DTSTAMP:20140213T1254140 +DTSTAMP:20140213T125414Z DTSTART;TZID=Europe/Berlin:%(start)s DTEND;TZID=Europe/Berlin:%(end)s SUMMARY:%(summary)s @@ -48,7 +49,7 @@ CALSCALE:GREGORIAN METHOD:CANCEL BEGIN:VEVENT UID:%(uid)s -DTSTAMP:20140218T1254140 +DTSTAMP:20140218T125414Z DTSTART;TZID=Europe/Berlin:20120713T100000 DTEND;TZID=Europe/Berlin:20120713T110000 SUMMARY:%(summary)s @@ -69,7 +70,7 @@ CALSCALE:GREGORIAN METHOD:REQUEST BEGIN:VEVENT UID:%(uid)s -DTSTAMP:20140213T1254140 +DTSTAMP:20140213T125414Z DTSTART;TZID=Europe/Zurich:%(start)s DTEND;TZID=Europe/Zurich:%(end)s RRULE:FREQ=WEEKLY;INTERVAL=1;COUNT=10 @@ -295,6 +296,14 @@ class TestWallaceInvitationpolicy(unittest.TestCase): event.set_summary(summary) event.set_sequence(sequence) + # create event with attachment + vattach = event.get_attachments() + attachment = kolabformat.Attachment() + attachment.setLabel('attach.txt') + attachment.setData('This is a text attachment', 'text/plain') + vattach.append(attachment) + event.event.setAttachments(vattach) + imap = IMAP() imap.connect() @@ -365,12 +374,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase): if uid and event_message['subject'] != uid: continue - for part in event_message.walk(): - if part.get_content_type() == "application/calendar+xml": - payload = part.get_payload(decode=True) - found = pykolab.xml.event_from_string(payload) - break - + found = event_from_message(event_message) if found: break @@ -506,6 +510,11 @@ class TestWallaceInvitationpolicy(unittest.TestCase): self.assertIsInstance(attendee, pykolab.xml.Attendee) self.assertEqual(attendee.get_participant_status(), kolabformat.PartAccepted) + # check attachments in update event + attachments = event.get_attachments() + self.assertEqual(len(attachments), 1) + self.assertEqual(event.get_attachment_data(0), 'This is a text attachment') + def test_007_invitation_cancel(self): self.purge_mailbox(self.john['mailbox']) |