summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-08-05 04:22:22 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-08-05 04:22:22 (GMT)
commit78b688519c8b73d66ab1f4fba74ab39acdf9552f (patch)
tree0ba7333b076098005b93b8901f6890af975f95ae
parente636a436365e2025e50ed7eb16105f134412bd62 (diff)
downloadpykolab-78b688519c8b73d66ab1f4fba74ab39acdf9552f.tar.gz
Respect transparency property for conflict detection; fix tests for translated iTip message contents
-rw-r--r--pykolab/itip/__init__.py4
-rw-r--r--tests/unit/test-011-itip.py10
2 files changed, 11 insertions, 3 deletions
diff --git a/pykolab/itip/__init__.py b/pykolab/itip/__init__.py
index c30421a..ddcb392 100644
--- a/pykolab/itip/__init__.py
+++ b/pykolab/itip/__init__.py
@@ -144,7 +144,9 @@ def check_event_conflict(kolab_event, itip_event):
if kolab_event.uid == itip_event['uid']:
return conflict
- # TODO: don't consider conflict if event has TRANSP:TRANSPARENT
+ # don't consider conflict if event has TRANSP:TRANSPARENT
+ if kolab_event.get_transparency():
+ return conflict
_es = to_dt(kolab_event.get_start())
_ee = to_dt(kolab_event.get_ical_dtend()) # use iCal style end date: next day for all-day events
diff --git a/tests/unit/test-011-itip.py b/tests/unit/test-011-itip.py
index a120fd2..a08d05f 100644
--- a/tests/unit/test-011-itip.py
+++ b/tests/unit/test-011-itip.py
@@ -5,6 +5,8 @@ import kolabformat
from pykolab import itip
from pykolab.xml import Event
+from pykolab.xml import participant_status_label
+from pykolab.translate import _
from icalendar import Calendar
from email import message
@@ -363,6 +365,9 @@ class TestITip(unittest.TestCase):
self.assertTrue(itip.check_event_conflict(allday, itip_event), "Conflicting allday event")
+ allday.set_transparency(True)
+ self.assertFalse(itip.check_event_conflict(allday, itip_event), "No conflict if event is set to transparent")
+
event2 = Event()
event2.set_start(datetime.datetime(2012,7,13, 10,0,0, tzinfo=pytz.timezone("US/Central")))
event2.set_end(datetime.datetime(2012,7,13, 11,0,0, tzinfo=pytz.timezone("US/Central")))
@@ -398,9 +403,10 @@ class TestITip(unittest.TestCase):
self.assertEqual(self.smtplog[0][0], 'resource-collection-car@example.org', "From attendee")
self.assertEqual(self.smtplog[0][1], 'john.doe@example.org', "To organizer")
+ _accepted = participant_status_label('ACCEPTED')
message = message_from_string(self.smtplog[0][2])
- self.assertEqual(message.get('Subject'), 'Invitation for test was ACCEPTED')
+ 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('STATUS=' + _accepted, text)