summaryrefslogtreecommitdiffstats
path: root/tests/functional/test_wallace/test_007_invitationpolicy.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-07-07 18:43:25 -0400
committerThomas Bruederli <bruederli@kolabsys.com>2014-07-07 18:43:25 -0400
commita674289628249f45ec46c3096b1c476692943ff3 (patch)
tree56a6085d94514a2098eaca41e847e39cb50e693a /tests/functional/test_wallace/test_007_invitationpolicy.py
parent6e137a89f6f29975133633e2e70557b3954d4220 (diff)
downloadpykolab-a674289628249f45ec46c3096b1c476692943ff3.tar.gz
Use new pykolab.xml.event_from_message() function in wallace modules and verify that attachments survive event updates
Diffstat (limited to 'tests/functional/test_wallace/test_007_invitationpolicy.py')
-rw-r--r--tests/functional/test_wallace/test_007_invitationpolicy.py27
1 files changed, 18 insertions, 9 deletions
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'])