summaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-11-19 21:27:09 -0500
committerThomas Bruederli <bruederli@kolabsys.com>2014-11-19 21:27:09 -0500
commitd49a7ea6c05521995afa8b73fcf0e638931f83d9 (patch)
tree0dba2a27ac7e09bd59ea01d789855f78c6daaa78 /tests/unit
parentd65762d548ef3869db2947d7f74434708c0b0820 (diff)
downloadpykolab-d49a7ea6c05521995afa8b73fcf0e638931f83d9.tar.gz
Build iTip response and notification messages with unicode strings (#3926) + adjust tests
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test-011-itip.py12
-rw-r--r--tests/unit/test-012-wallace_invitationpolicy.py12
2 files changed, 21 insertions, 3 deletions
diff --git a/tests/unit/test-011-itip.py b/tests/unit/test-011-itip.py
index cb1b760..e5edee5 100644
--- a/tests/unit/test-011-itip.py
+++ b/tests/unit/test-011-itip.py
@@ -465,5 +465,13 @@ class TestITip(unittest.TestCase):
self.assertEqual(message.get('Subject'), _("Invitation for %(summary)s was %(status)s") % { 'summary':'test', 'status':_accepted })
text = str(message.get_payload(0));
- self.assertIn('SUMMARY=test', text)
- self.assertIn('STATUS=' + _accepted, text)
+ self.assertIn('SUMMARY=3Dtest', text)
+ self.assertIn('STATUS=3D' + _accepted, text)
+
+ def test_004_send_reply_unicode(self):
+ itip_events = itip.events_from_message(message_from_string(itip_non_multipart.replace('SUMMARY:test', "SUMMARY:With äöü")))
+ itip.send_reply("resource-collection-car@example.org", itip_events, "SUMMARY=%(summary)s; STATUS=%(status)s; NAME=%(name)s;")
+
+ self.assertEqual(len(self.smtplog), 1)
+ self.assertIn("Subject: =?utf-8?q?Invitation_for_With_=C3=A4=C3=B6=C3=BC_was_Accepted?=", self.smtplog[0][2])
+ self.assertIn('SUMMARY=3DWith =C3=A4=C3=B6=C3=BC', self.smtplog[0][2])
diff --git a/tests/unit/test-012-wallace_invitationpolicy.py b/tests/unit/test-012-wallace_invitationpolicy.py
index 3366950..20e139d 100644
--- a/tests/unit/test-012-wallace_invitationpolicy.py
+++ b/tests/unit/test-012-wallace_invitationpolicy.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
import os
import pykolab
import logging
@@ -160,4 +162,12 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertFalse( MIP.is_auto_reply({ 'kolabinvitationpolicy':accept_some }, 'sam@example.org', 'event'))
self.assertFalse( MIP.is_auto_reply({ 'kolabinvitationpolicy':accept_avail }, 'user@domain.com', 'event'))
self.assertTrue( MIP.is_auto_reply({ 'kolabinvitationpolicy':accept_avail }, 'john@example.org', 'event'))
- \ No newline at end of file
+
+ def test_006_send_update_notification(self):
+ itips = pykolab.itip.events_from_message(message_from_string(itip_multipart.replace('SUMMARY:test', 'SUMMARY:with äöü')))
+ MIP.send_update_notification(itips[0]['xml'], { 'mail': 'sender@example.org' }, old=None, reply=True)
+
+ self.assertEqual(len(self.smtplog), 1)
+ self.assertIn("Subject: =?utf-8?", self.smtplog[0][2])
+ self.assertIn("The event 'with =C3=A4=C3=B6=C3=BC' at", self.smtplog[0][2])
+