pykolab/xml tests/unit

Thomas Brüderli bruederli at kolabsys.com
Tue Sep 23 15:10:51 CEST 2014


 pykolab/xml/event.py         |    4 ++++
 tests/unit/test-003-event.py |    2 ++
 2 files changed, 6 insertions(+)

New commits:
commit d9f0b4336e151e5cb29b911f1e823289c3dc78bf
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Sat Aug 23 13:14:11 2014 -0400

    Add getter for the CLASS property to be exported to iCal

diff --git a/pykolab/xml/event.py b/pykolab/xml/event.py
index 7b9e13c..30b754f 100644
--- a/pykolab/xml/event.py
+++ b/pykolab/xml/event.py
@@ -534,6 +534,10 @@ class Event(object):
 
         return self._translate_value(status, self.status_map) if status else None
 
+    def get_ical_class(self):
+        class_ = self.event.classification()
+        return self._translate_value(class_, self.classification_map) if class_ else None
+
     def get_ical_sequence(self):
         return str(self.event.sequence()) if self.event.sequence() else None
 
diff --git a/tests/unit/test-003-event.py b/tests/unit/test-003-event.py
index 7124e0c..7fae6eb 100644
--- a/tests/unit/test-003-event.py
+++ b/tests/unit/test-003-event.py
@@ -434,6 +434,7 @@ END:VEVENT
         self.event.set_start(datetime.datetime(2014, 05, 23, 11, 00, 00, tzinfo=pytz.timezone("Europe/London")))
         self.event.set_end(datetime.datetime(2014, 05, 23, 12, 30, 00, tzinfo=pytz.timezone("Europe/London")))
         self.event.set_sequence(3)
+        self.event.set_classification('CONFIDENTIAL')
         self.event.add_custom_property('X-Custom', 'check')
 
         ical = icalendar.Calendar.from_ical(self.event.as_string_itip())
@@ -444,6 +445,7 @@ END:VEVENT
         self.assertEqual(event['sequence'], 3)
         self.assertEqual(event['X-CUSTOM'], "check")
         self.assertIsInstance(event['dtstamp'].dt, datetime.datetime)
+        self.assertEqual(event['class'], "CONFIDENTIAL")
 
     def test_019_to_message_itip(self):
         self.event = Event()




More information about the commits mailing list