summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-016-todo.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-02-10 09:26:56 +0100
committerThomas Bruederli <bruederli@kolabsys.com>2015-02-10 09:26:56 +0100
commit21c116a670c3a34a1e084e1af7c75541a1783f27 (patch)
treee2879e84682bcd5678cf15f33371396374154623 /tests/unit/test-016-todo.py
parente40632b31347e5c25a2fdae2cbfec91eb521b09a (diff)
downloadpykolab-21c116a670c3a34a1e084e1af7c75541a1783f27.tar.gz
Fix importing ical VTODO objects with attachments (#4532):
- Avoid serializing and re-parsing: accept icalendar.* instances in pykolab.xml.* wrapper classes - Don't attempt to load iCal data with libkolabxml as there's no support for it in the python bindings - Import ATTACH properties from iCal into the XML Todo object
Diffstat (limited to 'tests/unit/test-016-todo.py')
-rw-r--r--tests/unit/test-016-todo.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/unit/test-016-todo.py b/tests/unit/test-016-todo.py
index 2e55c63..dcb89c5 100644
--- a/tests/unit/test-016-todo.py
+++ b/tests/unit/test-016-todo.py
@@ -41,6 +41,43 @@ END:VTODO
END:VCALENDAR
"""
+ical_todo_attachment = """
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Roundcube//Roundcube libcalendaring 1.1-git//Sabre//Sabre VObject
+ 2.1.3//EN
+CALSCALE:GREGORIAN
+BEGIN:VTODO
+UID:18C2EBBD8B31D99F7AA578EDFDFB1AC0-FCBB6C4091F28CA0
+DTSTAMP;VALUE=DATE-TIME:20140820T101333Z
+CREATED;VALUE=DATE-TIME:20140731T100704Z
+LAST-MODIFIED;VALUE=DATE-TIME:20140820T101333Z
+DUE;VALUE=DATE-TIME;TZID=Europe/London:20150228T133000
+SUMMARY:Task with attachment
+SEQUENCE:3
+PRIORITY:1
+STATUS:IN-PROCESS
+ORGANIZER;CN=Thomas:mailto:thomas.bruederli@example.org
+ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=image/png;X-L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xuNITaaxyD9mT2WvSDAXn/
+ Pvhh8BBgBjyfPSGbSYcwAAAABJRU5ErkJggg==
+END:VTODO
+END:VCALENDAR
+"""
+
xml_todo = """
<icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0">
<vcalendar>
@@ -223,6 +260,16 @@ METHOD:REQUEST
self.assertIsInstance(vtodo['dtstamp'].dt, datetime.datetime)
+ def test_022_ical_with_attachment(self):
+ todo = todo_from_ical(ical_todo_attachment)
+
+ vattachment = todo.get_attachments()
+ self.assertEqual(len(vattachment), 1)
+
+ attachment = vattachment[0]
+ self.assertEqual(attachment.mimetype(), 'image/png')
+ self.assertEqual(attachment.label(), 'silhouette.png')
+
def test_030_to_dict(self):
data = todo_from_string(xml_todo).to_dict()