[CalendarServer-changes] [14343] CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav /datastore/scheduling

source_changes at macosforge.org source_changes at macosforge.org
Mon Jan 26 08:30:27 PST 2015


Revision: 14343
          http://trac.calendarserver.org//changeset/14343
Author:   cdaboo at apple.com
Date:     2015-01-26 08:30:27 -0800 (Mon, 26 Jan 2015)
Log Message:
-----------
Fix iTIP REPLY processing for the case where the organizer's copy of the event has overrides in it that are not in the iTIP message.

Modified Paths:
--------------
    CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/itip.py
    CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/test/test_itip.py

Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/itip.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/itip.py	2015-01-24 17:52:19 UTC (rev 14342)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/itip.py	2015-01-26 16:30:27 UTC (rev 14343)
@@ -348,6 +348,23 @@
                 if partstat or private_comment:
                     rids.add(("", partstat, private_comment,))
 
+        # Make sure all overridden components in the organizer's copy have matching overridden components
+        # in the iTIP message
+        for organizer_component in calendar.subcomponents():
+            if organizer_component.name() == "VTIMEZONE":
+                continue
+            rid = organizer_component.getRecurrenceIDUTC()
+            if rid is None:
+                continue
+            match_component = itip_message.overriddenComponent(rid)
+            if match_component is None:
+                match_component = itip_message.deriveInstance(rid)
+                if match_component is not None:
+                    itip_message.addComponent(match_component)
+                else:
+                    log.error("Ignoring instance: %s missing in iTIP REPLY for: %s" % (rid, itip_message.resourceUID()))
+                    continue
+
         # Now do all overridden ones (sort by RECURRENCE-ID)
         sortedComponents = []
         for itip_component in itip_message.subcomponents():

Modified: CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/test/test_itip.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/test/test_itip.py	2015-01-24 17:52:19 UTC (rev 14342)
+++ CalendarServer/branches/release/CalendarServer-5.4-dev/txdav/caldav/datastore/scheduling/test/test_itip.py	2015-01-26 16:30:27 UTC (rev 14343)
@@ -34,29 +34,27 @@
     iCalendar support tests
     """
 
-    def test_processRequest_overrideOfEXDATE(self):
+    def test_processRequest(self):
         """
-        Test iTIPProcessing.processRequest properly removes an EXDATE when an override is added
+        Test iTIPProcessing.processRequest works properly for various scenarios.
         """
 
         data = (
             (
-                "1.1 Single single-value EXDATE",
+                "1.1 Attendee added to master after appearing on override only",
                 """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
 UID:12345-67890-1
-DTSTART:20071114T000000Z
+RECURRENCE-ID:20071114T000000Z
+DTSTART:20071114T010000Z
 DURATION:PT1H
 DTSTAMP:20071114T000000Z
 ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+ATTENDEE:mailto:user02 at example.com
 ORGANIZER:mailto:user01 at example.com
-RRULE:FREQ=DAILY
-EXDATE:20071115T000000Z
-SUMMARY:Test
-TRANSP:TRANSPARENT
+SUMMARY:Test - override
 END:VEVENT
 END:VCALENDAR
 """,
@@ -66,254 +64,58 @@
 METHOD:REQUEST
 BEGIN:VEVENT
 UID:12345-67890-1
-RECURRENCE-ID:20071115T000000Z
-DTSTART:20071115T000000Z
+DTSTART:20071113T000000Z
 DURATION:PT1H
 DTSTAMP:20071114T000000Z
 ATTENDEE:mailto:user01 at example.com
 ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
 ORGANIZER:mailto:user01 at example.com
-SUMMARY:Test1
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-DURATION:PT1H
-DTSTAMP:20071114T000000Z
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-ORGANIZER:mailto:user01 at example.com
 RRULE:FREQ=DAILY
 SUMMARY:Test
-TRANSP:TRANSPARENT
 END:VEVENT
 BEGIN:VEVENT
 UID:12345-67890-1
-RECURRENCE-ID:20071115T000000Z
-DTSTART:20071115T000000Z
+RECURRENCE-ID:20071114T000000Z
+DTSTART:20071114T010000Z
 DURATION:PT1H
 DTSTAMP:20071114T000000Z
 ATTENDEE:mailto:user01 at example.com
 ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
 ORGANIZER:mailto:user01 at example.com
-SUMMARY:Test1
-TRANSP:TRANSPARENT
+SUMMARY:Test - override
 END:VEVENT
 END:VCALENDAR
 """,
-            ),
-            (
-                "1.2 Single multi-value EXDATE",
                 """BEGIN:VCALENDAR
 VERSION:2.0
 PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
 BEGIN:VEVENT
 UID:12345-67890-1
-DTSTART:20071114T000000Z
+DTSTART:20071113T000000Z
 DURATION:PT1H
 DTSTAMP:20071114T000000Z
 ATTENDEE:mailto:user01 at example.com
 ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
 ORGANIZER:mailto:user01 at example.com
 RRULE:FREQ=DAILY
-EXDATE:20071115T000000Z,20071116T000000Z
 SUMMARY:Test
 TRANSP:TRANSPARENT
 END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-METHOD:REQUEST
 BEGIN:VEVENT
 UID:12345-67890-1
-RECURRENCE-ID:20071115T000000Z
-DTSTART:20071115T000000Z
+RECURRENCE-ID:20071114T000000Z
+DTSTART:20071114T010000Z
 DURATION:PT1H
 DTSTAMP:20071114T000000Z
 ATTENDEE:mailto:user01 at example.com
 ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
 ORGANIZER:mailto:user01 at example.com
-SUMMARY:Test1
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-DURATION:PT1H
-DTSTAMP:20071114T000000Z
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-ORGANIZER:mailto:user01 at example.com
-RRULE:FREQ=DAILY
-EXDATE:20071116T000000Z
-SUMMARY:Test
+SUMMARY:Test - override
 TRANSP:TRANSPARENT
 END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890-1
-RECURRENCE-ID:20071115T000000Z
-DTSTART:20071115T000000Z
-DURATION:PT1H
-DTSTAMP:20071114T000000Z
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-ORGANIZER:mailto:user01 at example.com
-SUMMARY:Test1
-TRANSP:TRANSPARENT
-END:VEVENT
 END:VCALENDAR
 """,
             ),
-            (
-                "1.3 Multiple single-value EXDATEs",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-DURATION:PT1H
-DTSTAMP:20071114T000000Z
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-ORGANIZER:mailto:user01 at example.com
-RRULE:FREQ=DAILY
-EXDATE:20071115T000000Z
-EXDATE:20071116T000000Z
-SUMMARY:Test
-TRANSP:TRANSPARENT
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-METHOD:REQUEST
-BEGIN:VEVENT
-UID:12345-67890-1
-RECURRENCE-ID:20071115T000000Z
-DTSTART:20071115T000000Z
-DURATION:PT1H
-DTSTAMP:20071114T000000Z
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-ORGANIZER:mailto:user01 at example.com
-SUMMARY:Test1
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-DURATION:PT1H
-DTSTAMP:20071114T000000Z
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-ORGANIZER:mailto:user01 at example.com
-RRULE:FREQ=DAILY
-EXDATE:20071116T000000Z
-SUMMARY:Test
-TRANSP:TRANSPARENT
-END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890-1
-RECURRENCE-ID:20071115T000000Z
-DTSTART:20071115T000000Z
-DURATION:PT1H
-DTSTAMP:20071114T000000Z
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-ORGANIZER:mailto:user01 at example.com
-SUMMARY:Test1
-TRANSP:TRANSPARENT
-END:VEVENT
-END:VCALENDAR
-""",
-            ),
-            (
-                "1.4 Multiple single- and multi-value EXDATEs",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-DURATION:PT1H
-DTSTAMP:20071114T000000Z
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-ORGANIZER:mailto:user01 at example.com
-RRULE:FREQ=DAILY
-EXDATE:20071115T000000Z,20071116T000000Z
-EXDATE:20071117T000000Z
-SUMMARY:Test
-TRANSP:TRANSPARENT
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-METHOD:REQUEST
-BEGIN:VEVENT
-UID:12345-67890-1
-RECURRENCE-ID:20071115T000000Z
-DTSTART:20071115T000000Z
-DURATION:PT1H
-DTSTAMP:20071114T000000Z
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-ORGANIZER:mailto:user01 at example.com
-SUMMARY:Test1
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-DURATION:PT1H
-DTSTAMP:20071114T000000Z
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-ORGANIZER:mailto:user01 at example.com
-RRULE:FREQ=DAILY
-EXDATE:20071116T000000Z
-EXDATE:20071117T000000Z
-SUMMARY:Test
-TRANSP:TRANSPARENT
-END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890-1
-RECURRENCE-ID:20071115T000000Z
-DTSTART:20071115T000000Z
-DURATION:PT1H
-DTSTAMP:20071114T000000Z
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-ORGANIZER:mailto:user01 at example.com
-SUMMARY:Test1
-TRANSP:TRANSPARENT
-END:VEVENT
-END:VCALENDAR
-""",
-            ),
         )
 
         for title, calendar_txt, itip_txt, changed_txt in data:
@@ -321,214 +123,11 @@
             itip = Component.fromString(itip_txt)
             changed = Component.fromString(changed_txt)
 
-            result, _ignore = iTipProcessing.processRequest(itip, calendar, "mailto:user02 at example.com")
+            result, rids = iTipProcessing.processRequest(itip, calendar, "mailto:user02 at example.com")
+            self.assertEqual(len(rids), 0)
             self.assertEqual(result, changed, msg="Calendar mismatch: %s" % (title,))
 
 
-    def test_processReply(self):
-        """
-        Test iTIPProcessing.processReply
-        """
-
-        data = (
-            (
-                "1.1 Simple Reply - non recurring",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-DTSTAMP:20071114T000000Z
-ORGANIZER:mailto:user01 at example.com
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-METHOD:REPLY
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071115T000000Z
-DTSTAMP:20071114T000000Z
-ORGANIZER:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-DTSTAMP:20071114T000000Z
-ORGANIZER:mailto:user01 at example.com
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:user02 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                True,
-            ),
-            (
-                "1.2 Simple Reply - recurring no overrides",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-DTSTAMP:20071114T000000Z
-ORGANIZER:mailto:user01 at example.com
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-RRULE:FREQ=DAILY
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-METHOD:REPLY
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071115T000000Z
-DTSTAMP:20071114T000000Z
-ORGANIZER:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
-RRULE:FREQ=DAILY
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-DTSTAMP:20071114T000000Z
-ORGANIZER:mailto:user01 at example.com
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:user02 at example.com
-RRULE:FREQ=DAILY
-END:VEVENT
-END:VCALENDAR
-""",
-                True,
-            ),
-            (
-                "1.3 Simple Reply - recurring with missing master",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-RECURRENCE-ID:20071114T000000Z
-DTSTART:20071114T000000Z
-DTSTAMP:20071114T000000Z
-ORGANIZER:mailto:user01 at example.com
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-METHOD:REPLY
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071115T000000Z
-DTSTAMP:20071114T000000Z
-ORGANIZER:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
-RRULE:FREQ=DAILY
-END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890-1
-RECURRENCE-ID:20071114T000000Z
-DTSTART:20071115T000000Z
-DTSTAMP:20071114T000000Z
-ORGANIZER:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-RECURRENCE-ID:20071114T000000Z
-DTSTART:20071114T000000Z
-DTSTAMP:20071114T000000Z
-ORGANIZER:mailto:user01 at example.com
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:user02 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                True,
-            ),
-            (
-                "1.4 Simple Reply - recurring with missing master, invalid override",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-RECURRENCE-ID:20071114T000000Z
-DTSTART:20071114T000000Z
-DTSTAMP:20071114T000000Z
-ORGANIZER:mailto:user01 at example.com
-ATTENDEE:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-METHOD:REPLY
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-DTSTAMP:20071114T000000Z
-ORGANIZER:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
-RRULE:FREQ=DAILY
-END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890-1
-RECURRENCE-ID:20071115T000000Z
-DTSTART:20071115T000000Z
-DTSTAMP:20071114T000000Z
-ORGANIZER:mailto:user01 at example.com
-ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                None,
-                False,
-            ),
-        )
-
-        for title, calendar_txt, itip_txt, changed_txt, expected in data:
-            calendar = Component.fromString(calendar_txt)
-            itip = Component.fromString(itip_txt)
-            if expected:
-                changed = Component.fromString(changed_txt)
-
-            result, _ignore = iTipProcessing.processReply(itip, calendar)
-            self.assertEqual(result, expected, msg="Result mismatch: %s" % (title,))
-            if expected:
-                self.assertEqual(changed, calendar, msg="Calendar mismatch: %s" % (title,))
-
-
     def test_processRequest_scheduleAgentChange(self):
         """
         Test iTIPProcessing.processRequest properly replaces a SCHEDULE-AGENT=CLIENT component with a
@@ -1173,6 +772,370 @@
             self.assertEqual(result, changed, msg="Calendar mismatch: %s" % (title,))
 
 
+    def test_processReply(self):
+        """
+        Test iTIPProcessing.processReply
+        """
+
+        data = (
+            (
+                "1.1 Simple Reply - non recurring",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REPLY
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071115T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                True,
+            ),
+            (
+                "1.2 Simple Reply - recurring no overrides",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+RRULE:FREQ=DAILY
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REPLY
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071115T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
+RRULE:FREQ=DAILY
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:user02 at example.com
+RRULE:FREQ=DAILY
+END:VEVENT
+END:VCALENDAR
+""",
+                True,
+            ),
+            (
+                "1.3 Simple Reply - recurring with missing master",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071114T000000Z
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REPLY
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071115T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
+RRULE:FREQ=DAILY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071114T000000Z
+DTSTART:20071115T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071114T000000Z
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                True,
+            ),
+            (
+                "1.4 Simple Reply - recurring with overrides in master but not reply",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+RRULE:FREQ=DAILY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071114T000000Z
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REPLY
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
+RRULE:FREQ=DAILY
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:user02 at example.com
+RRULE:FREQ=DAILY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071114T000000Z
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                True,
+            ),
+            (
+                "1.5 Simple Reply - recurring with overrides in master invalid in reply",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+RRULE:FREQ=DAILY;COUNT=3
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071116T000000Z
+DTSTART:20071116T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REPLY
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
+RRULE:FREQ=DAILY;COUNT=2
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:user02 at example.com
+RRULE:FREQ=DAILY;COUNT=3
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071116T000000Z
+DTSTART:20071116T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                True,
+            ),
+            (
+                "1.6 Simple Reply - recurring with overrides in master, invalid ones in reply",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+RRULE:FREQ=DAILY;COUNT=2
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+METHOD:REPLY
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
+RRULE:FREQ=DAILY;COUNT=3
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071116T000000Z
+DTSTART:20071116T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:user02 at example.com
+RRULE:FREQ=DAILY;COUNT=2
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-1
+RECURRENCE-ID:20071115T000000Z
+DTSTART:20071115T000000Z
+DTSTAMP:20071114T000000Z
+ORGANIZER:mailto:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED;SCHEDULE-STATUS=2.0:mailto:user02 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                True,
+            ),
+        )
+
+        for title, calendar_txt, itip_txt, changed_txt, expected in data:
+            calendar = Component.fromString(calendar_txt)
+            itip = Component.fromString(itip_txt)
+            if expected:
+                changed = Component.fromString(changed_txt)
+
+            result, _ignore = iTipProcessing.processReply(itip, calendar)
+            self.assertEqual(result, expected, msg="Result mismatch: %s" % (title,))
+            if expected:
+                self.assertEqual(changed, calendar, msg="Calendar mismatch: %s" % (title,))
+
+
     def test_update_attendee_partstat(self):
 
         data = (
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150126/091d8439/attachment-0001.html>


More information about the calendarserver-changes mailing list