pykolab/xml tests/unit

Thomas Brüderli bruederli at kolabsys.com
Wed Mar 25 16:13:05 CET 2015


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

New commits:
commit d222679e9db6abf76578f9b6c5e4ffb96464495c
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Tue Mar 24 18:17:39 2015 +0100

    Add getter for related-to property of todo objects

diff --git a/pykolab/xml/todo.py b/pykolab/xml/todo.py
index adc4e2b..2103427 100644
--- a/pykolab/xml/todo.py
+++ b/pykolab/xml/todo.py
@@ -47,6 +47,7 @@ class Todo(Event):
         self.properties_map.update({
             "due": "get_due",
             "percent-complete": "get_percentcomplete",
+            "related-to": "get_related_to",
             "duration": "void",
             "end": "void"
         })
@@ -184,6 +185,11 @@ class Todo(Event):
     def get_duration(self):
         return None
 
+    def get_related_to(self):
+        for x in self.event.relatedTo():
+            return x
+        return None
+
     def as_string_itip(self, method="REQUEST"):
         cal = icalendar.Calendar()
         cal.add(
diff --git a/tests/unit/test-016-todo.py b/tests/unit/test-016-todo.py
index 91562c3..b94d12d 100644
--- a/tests/unit/test-016-todo.py
+++ b/tests/unit/test-016-todo.py
@@ -114,6 +114,9 @@ xml_todo = """
           <categories>
             <text>iTip</text>
           </categories>
+          <related-to>
+            <text>9F3E68BED4A94DA2A51EE589F7FDC6C8-A4BF5BBB9FEAA271</text>
+          </related-to>
           <dtstart>
             <parameters>
               <tzid><text>/kolab.org/Europe/Berlin</text></tzid>
@@ -222,6 +225,7 @@ class TestTodoXML(unittest.TestCase):
         self.assertIsInstance(todo.get_organizer(), kolabformat.ContactReference)
         self.assertEqual(todo.get_organizer().name(), "Thomas")
         self.assertEqual(todo.get_status(True), "IN-PROCESS")
+        self.assertEqual(todo.get_related_to(), "9F3E68BED4A94DA2A51EE589F7FDC6C8-A4BF5BBB9FEAA271")
 
 
     def test_020_load_from_ical(self):




More information about the commits mailing list