summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-08-06 16:44:37 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-08-06 16:44:37 (GMT)
commit41a8d8edc3938880b363ccd0cc688f73f4e37867 (patch)
tree151830d9e10d15a1fc0ef724c4255e24ecf30b4d
parent9febaa9596bff65c25f81688283fbf5940a4bdef (diff)
downloadpykolab-41a8d8edc3938880b363ccd0cc688f73f4e37867.tar.gz
Add test for owner confirmation on (delegated) resource collection bookings
-rw-r--r--tests/functional/test_wallace/test_005_resource_invitation.py19
-rw-r--r--wallace/module_resources.py2
2 files changed, 20 insertions, 1 deletions
diff --git a/tests/functional/test_wallace/test_005_resource_invitation.py b/tests/functional/test_wallace/test_005_resource_invitation.py
index 61b9402..0f05993 100644
--- a/tests/functional/test_wallace/test_005_resource_invitation.py
+++ b/tests/functional/test_wallace/test_005_resource_invitation.py
@@ -779,3 +779,22 @@ class TestResourceInvitation(unittest.TestCase):
event = self.check_resource_calendar_event(self.room3['kolabtargetfolder'], uid)
self.assertIsInstance(event, pykolab.xml.Event)
self.assertEqual(event.get_attendee_by_email(self.room3['mail']).get_participant_status(True), 'ACCEPTED')
+
+
+ def test_016_collection_owner_confirmation(self):
+ self.purge_mailbox(self.john['mailbox'])
+
+ uid = self.send_itip_invitation(self.viprooms['mail'], datetime.datetime(2014,8,15, 17,0,0))
+
+ # resource collection responds with a DELEGATED message
+ response = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('DELEGATED') }, self.viprooms['mail'])
+ self.assertIsInstance(response, email.message.Message)
+
+ # the collection member tentatively accepted the reservation
+ accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('TENTATIVE') })
+ self.assertIsInstance(accept, email.message.Message)
+ self.assertIn(self.room3['mail'], accept['from'])
+
+ # check confirmation message sent to resource owner (jane)
+ notify = self.check_message_received(_('Booking request for %s requires confirmation') % (self.room3['cn']), mailbox=self.jane['mailbox'])
+ self.assertIsInstance(notify, email.message.Message)
diff --git a/wallace/module_resources.py b/wallace/module_resources.py
index c0983ca..ae6cd06 100644
--- a/wallace/module_resources.py
+++ b/wallace/module_resources.py
@@ -314,7 +314,7 @@ def execute(*args, **kw):
continue
# ignore updates and cancellations to resource collections who already delegated the event
- if receiving_attendee.get_delegated_to().size() > 0 or receiving_attendee.get_role() == kolabformat.NonParticipant:
+ if len(receiving_attendee.get_delegated_to()) > 0 or receiving_attendee.get_role() == kolabformat.NonParticipant:
done = True
log.debug(_("Recipient %r is non-participant, ignoring message") % (receiving_resource['mail']), level=8)