summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-03-02 12:57:32 -0500
committerThomas Bruederli <bruederli@kolabsys.com>2015-03-02 12:57:32 -0500
commite0cdbb50abceae359934f6421445491315069ab7 (patch)
treee415d3bc985e34bf9c30d42afbabbfbc7102c016 /tests
parent403257f86465a53237bb88fd6c7f2d292ab9f041 (diff)
downloadpykolab-e0cdbb50abceae359934f6421445491315069ab7.tar.gz
Store reservations for single occurrences with the same UID in one object (#4766)
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/test_wallace/test_005_resource_invitation.py42
-rw-r--r--tests/unit/test-011-itip.py3
2 files changed, 39 insertions, 6 deletions
diff --git a/tests/functional/test_wallace/test_005_resource_invitation.py b/tests/functional/test_wallace/test_005_resource_invitation.py
index e7ac0f3..af84fa6 100644
--- a/tests/functional/test_wallace/test_005_resource_invitation.py
+++ b/tests/functional/test_wallace/test_005_resource_invitation.py
@@ -360,7 +360,7 @@ class TestResourceInvitation(unittest.TestCase):
return found
- def check_resource_calendar_event(self, mailbox, uid=None, instance=None):
+ def check_resource_calendar_event(self, mailbox, uid=None):
imap = IMAP()
imap.connect()
@@ -383,7 +383,7 @@ class TestResourceInvitation(unittest.TestCase):
continue
found = event_from_message(event_message)
- if found and (instance is None or found.is_recurring() or xmlutils.dates_equal(instance, found.get_recurrence_id())):
+ if found:
break
time.sleep(1)
@@ -904,16 +904,34 @@ class TestResourceInvitation(unittest.TestCase):
self.assertIsInstance(accept, email.message.Message)
self.assertIn("RECURRENCE-ID;TZID=Europe/London:" + start.strftime('%Y%m%dT%H%M%S'), str(accept))
- # the resource calendar now has two reservations stored
- one = self.check_resource_calendar_event(self.boxter['kolabtargetfolder'], uid, start)
+ # the resource calendar now has two reservations stored in one object
+ one = self.check_resource_calendar_event(self.boxter['kolabtargetfolder'], uid)
self.assertIsInstance(one, pykolab.xml.Event)
self.assertIsInstance(one.get_recurrence_id(), datetime.datetime)
self.assertEqual(one.get_start().hour, exstart.hour)
- two = self.check_resource_calendar_event(self.boxter['kolabtargetfolder'], uid, nextstart)
+ two = one.get_instance(nextstart)
self.assertIsInstance(two, pykolab.xml.Event)
self.assertIsInstance(two.get_recurrence_id(), datetime.datetime)
+ self.purge_mailbox(self.john['mailbox'])
+
+ # send rescheduling request to the 2nd instance
+ self.send_itip_update(self.boxter['mail'], uid, nextstart + datetime.timedelta(hours=2), sequence=2, instance=nextstart)
+
+ accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ self.assertIsInstance(accept, email.message.Message)
+ self.assertIn("RECURRENCE-ID;TZID=Europe/London:" + nextstart.strftime('%Y%m%dT%H%M%S'), str(accept))
+
+ event = self.check_resource_calendar_event(self.boxter['kolabtargetfolder'], uid)
+ self.assertIsInstance(event, pykolab.xml.Event)
+ self.assertEqual(len(event.get_exceptions()), 1)
+
+ two = event.get_instance(nextstart)
+ self.assertIsInstance(two, pykolab.xml.Event)
+ self.assertEqual(two.get_sequence(), 2)
+ self.assertEqual(two.get_start().hour, 20)
+
def test_019_cancel_single_occurrence(self):
self.purge_mailbox(self.john['mailbox'])
@@ -937,6 +955,20 @@ class TestResourceInvitation(unittest.TestCase):
self.assertEqual(exception.get_status(True), 'CANCELLED')
self.assertTrue(exception.get_transparency())
+ self.purge_mailbox(self.john['mailbox'])
+
+ # store a single occurrence with recurrence-id
+ start = datetime.datetime(2015,3,2, 18,30,0)
+ uid = self.send_itip_invitation(self.passat['mail'], start, instance=start)
+
+ accept = self.check_message_received(self.itip_reply_subject % { 'summary':'test', 'status':participant_status_label('ACCEPTED') })
+ self.assertIsInstance(accept, email.message.Message)
+
+ self.send_itip_cancel(self.passat['mail'], uid, instance=start)
+
+ time.sleep(5) # wait for IMAP to update
+ self.assertEqual(self.check_resource_calendar_event(self.passat['kolabtargetfolder'], uid), None)
+
def test_020_owner_confirmation_single_occurrence(self):
self.purge_mailbox(self.john['mailbox'])
diff --git a/tests/unit/test-011-itip.py b/tests/unit/test-011-itip.py
index 8179aa9..e47d314 100644
--- a/tests/unit/test-011-itip.py
+++ b/tests/unit/test-011-itip.py
@@ -501,6 +501,7 @@ class TestITip(unittest.TestCase):
second.set_start(dtstart + datetime.timedelta(hours=1))
second.set_end(dtstart + datetime.timedelta(hours=2))
second.set_recurrence_id(dtstart)
+ second.set_transparency(True)
itip_event['xml'].add_exception(second)
self.assertEqual(len(itip_event['xml'].get_exceptions()), 1)
@@ -514,7 +515,7 @@ class TestITip(unittest.TestCase):
event.set_start(datetime.datetime(2012,7,15, 11,0,0, tzinfo=itip_event['start'].tzinfo))
event.set_end(datetime.datetime(2012,7,15, 11,30,0, tzinfo=itip_event['start'].tzinfo))
- self.assertTrue(itip.check_event_conflict(event, itip_event), "Conflicting dates (exception)")
+ self.assertFalse(itip.check_event_conflict(event, itip_event), "Conflicting dates (exception)")
def test_003_send_reply(self):