summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-003-event.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-08-22 15:12:45 -0400
committerThomas Bruederli <bruederli@kolabsys.com>2014-08-22 15:12:45 -0400
commitfd68e0f4527f27fb406861036108d44cf500612e (patch)
treea4b7ed8a2939088c8d886635221ede79864f6eb0 /tests/unit/test-003-event.py
parent3231cd8408132d3f7ddb3ac1626a049474101101 (diff)
downloadpykolab-fd68e0f4527f27fb406861036108d44cf500612e.tar.gz
List event/task properties changes in update notification mails (#3447)
Diffstat (limited to 'tests/unit/test-003-event.py')
-rw-r--r--tests/unit/test-003-event.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/unit/test-003-event.py b/tests/unit/test-003-event.py
index 6a9fd4f..7124e0c 100644
--- a/tests/unit/test-003-event.py
+++ b/tests/unit/test-003-event.py
@@ -5,6 +5,7 @@ import sys
import unittest
import kolabformat
import icalendar
+import pykolab
from pykolab.xml import Attendee
from pykolab.xml import Event
@@ -15,6 +16,7 @@ from pykolab.xml import event_from_ical
from pykolab.xml import event_from_string
from pykolab.xml import event_from_message
from pykolab.xml import compute_diff
+from pykolab.xml import property_to_string
from collections import OrderedDict
ical_event = """
@@ -247,6 +249,17 @@ xml_event = """
class TestEventXML(unittest.TestCase):
event = Event()
+ @classmethod
+ def setUp(self):
+ """ Compatibility for twisted.trial.unittest
+ """
+ self.setup_class()
+
+ @classmethod
+ def setup_class(self, *args, **kw):
+ # set language to default
+ pykolab.translate.setUserLanguage('en_US')
+
def assertIsInstance(self, _value, _type):
if hasattr(unittest.TestCase, 'assertIsInstance'):
return unittest.TestCase.assertIsInstance(self, _value, _type)
@@ -640,6 +653,18 @@ END:VEVENT
self.assertEqual(pa['new'], dict(partstat='DECLINED'))
+ def test_026_property_to_string(self):
+ data = event_from_string(xml_event).to_dict()
+ self.assertEqual(property_to_string('sequence', data['sequence']), "1")
+ self.assertEqual(property_to_string('start', data['start']), "2014-08-13 10:00 (GMT)")
+ self.assertEqual(property_to_string('organizer', data['organizer']), "Doe, John")
+ self.assertEqual(property_to_string('attendee', data['attendee'][0]), "jane@example.org, Accepted")
+ self.assertEqual(property_to_string('rrule', data['rrule']), "Every 1 day(s) until 2014-07-25")
+ self.assertEqual(property_to_string('exdate', data['exdate'][0]), "2014-07-19")
+ self.assertEqual(property_to_string('alarm', data['alarm'][0]), "Display message 2 hour(s) before")
+ self.assertEqual(property_to_string('attach', data['attach'][0]), "noname.1395223627.5555")
+
+
def _find_prop_in_list(self, diff, name):
for prop in diff:
if prop['property'] == name: