[CalendarServer-changes] [14976] CalendarServer/branches/release/CalendarServer-5.4-dev/txdav

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 16 12:53:37 PDT 2015


Revision: 14976
          http://trac.calendarserver.org//changeset/14976
Author:   cdaboo at apple.com
Date:     2015-07-16 12:53:36 -0700 (Thu, 16 Jul 2015)
Log Message:
-----------
Fix for missing organizer record during attendee refresh.

Modified Paths:
--------------
    CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/implicit.py
    CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/test/test_implicit.py
    CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/common/datastore/test/util.py

Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/implicit.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/implicit.py	2015-07-16 19:02:35 UTC (rev 14975)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/implicit.py	2015-07-16 19:53:36 UTC (rev 14976)
@@ -427,7 +427,10 @@
         self.originatorPrincipal = self.calendar_home.directoryService().recordWithUID(self.calendar_home.uid())
 
         # Pick the canonical CUA:
-        self.originator = self.originatorPrincipal.canonicalCalendarUserAddress()
+        if self.originatorPrincipal is not None:
+            self.originator = self.originatorPrincipal.canonicalCalendarUserAddress()
+        else:
+            self.originator = "urn:uuid:{}".format(self.calendar_home.uid())
 
         # Get the ORGANIZER and verify it is the same for all components
         try:

Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/test/test_implicit.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/test/test_implicit.py	2015-07-16 19:02:35 UTC (rev 14975)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/test/test_implicit.py	2015-07-16 19:53:36 UTC (rev 14976)
@@ -40,6 +40,7 @@
 
 import hashlib
 import sys
+from calendarserver.platform.darwin.od.opendirectory import Directory
 
 class FakeScheduler(object):
     """
@@ -1563,6 +1564,91 @@
 
 
     @inlineCallbacks
+    def test_doImplicitScheduling_refreshAllAttendeesExceptSome_MissingOriginator(self):
+        """
+        Test that doImplicitScheduling delivers scheduling messages to attendees who can then reply,
+        even in the case of a missing originator record.
+        """
+
+        data1 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-attendee-reply
+DTSTAMP:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ORGANIZER;CN="User 01":mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE:mailto:user02 at example.com
+ATTENDEE:mailto:user03 at example.com
+END:VEVENT
+END:VCALENDAR
+"""
+        data2 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-attendee-reply
+DTSTAMP:20080601T120000Z
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ORGANIZER;CN="User 01":mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
+ATTENDEE:mailto:user03 at example.com
+END:VEVENT
+END:VCALENDAR
+"""
+
+        # Need refreshes to occur immediately, not via reactor.callLater
+        self.patch(config.Scheduling.Options, "AttendeeRefreshBatch", False)
+
+        yield self._createCalendarObject(data1, "user01", "test.ics")
+
+        list1 = (yield self._listCalendarObjects("user01", "inbox"))
+        self.assertEqual(len(list1), 0)
+
+        calendar1 = (yield self._getCalendarData("user01", "test.ics"))
+        self.assertTrue("SCHEDULE-STATUS=1.2" in calendar1)
+
+        list2 = (yield self._listCalendarObjects("user02", "inbox"))
+        self.assertEqual(len(list2), 1)
+
+        calendar2 = (yield self._getCalendarData("user02"))
+        self.assertTrue("PARTSTAT=ACCEPTED" not in calendar2)
+
+        list3 = (yield self._listCalendarObjects("user03", "inbox"))
+        self.assertEqual(len(list3), 1)
+
+        calendar3 = (yield self._getCalendarData("user03"))
+        self.assertTrue("PARTSTAT=ACCEPTED" not in calendar3)
+
+        self._sqlCalendarStore.directoryService().destroyRecord("user01")
+
+        yield self._setCalendarData(data2, "user02")
+
+        list1 = (yield self._listCalendarObjects("user01", "inbox"))
+        self.assertEqual(len(list1), 1)
+
+        calendar1 = (yield self._getCalendarData("user01", "test.ics"))
+        self.assertTrue("SCHEDULE-STATUS=2.0" in calendar1)
+        self.assertTrue("PARTSTAT=ACCEPTED" in calendar1)
+
+        list2 = (yield self._listCalendarObjects("user02", "inbox"))
+        self.assertEqual(len(list2), 1)
+
+        calendar2 = (yield self._getCalendarData("user02"))
+        self.assertTrue("PARTSTAT=ACCEPTED" in calendar2)
+
+        list3 = (yield self._listCalendarObjects("user03", "inbox"))
+        self.assertEqual(len(list3), 1)
+
+        calendar3 = (yield self._getCalendarData("user03"))
+        self.assertTrue("PARTSTAT=ACCEPTED" in calendar3)
+
+
+    @inlineCallbacks
     def test_doImplicitScheduling_OrganizerEventTimezoneDST(self):
         """
         Test that doImplicitScheduling delivers scheduling messages to attendees. This test

Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/common/datastore/test/util.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/common/datastore/test/util.py	2015-07-16 19:02:35 UTC (rev 14975)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/common/datastore/test/util.py	2015-07-16 19:53:36 UTC (rev 14976)
@@ -123,7 +123,11 @@
         self.records[record.uid] = record
 
 
+    def destroyRecord(self, uid):
+        del self.records[uid]
 
+
+
 class TestStoreDirectoryRecord(object):
 
     implements(IStoreDirectoryRecord)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150716/4ce789f0/attachment.html>


More information about the calendarserver-changes mailing list