[CalendarServer-changes] [2836] CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 20 12:47:16 PDT 2008


Revision: 2836
          http://trac.macosforge.org/projects/calendarserver/changeset/2836
Author:   cdaboo at apple.com
Date:     2008-08-20 12:47:16 -0700 (Wed, 20 Aug 2008)
Log Message:
-----------
Fix some unit tests.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/test/test_icaldiff.py
    CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/test/test_itip.py

Removed Paths:
-------------
    CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/test/test_itip.py

Modified: CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/test/test_icaldiff.py
===================================================================
--- CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/test/test_icaldiff.py	2008-08-19 19:09:10 UTC (rev 2835)
+++ CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/test/test_icaldiff.py	2008-08-20 19:47:16 UTC (rev 2836)
@@ -830,7 +830,7 @@
 
         for description, calendar1, calendar2, attendee, result in data:
             differ = iCalDiff(Component.fromString(calendar1), Component.fromString(calendar2))
-            self.assertEqual(differ.attendeeDiff(attendee), result, msg=description)
+            self.assertEqual(differ.attendeeMerge(attendee), result, msg=description)
 
     def test_attendee_diff_complex(self):
         
@@ -1162,4 +1162,4 @@
 
         for description, calendar1, calendar2, attendee, result in data:
             differ = iCalDiff(Component.fromString(calendar1), Component.fromString(calendar2))
-            self.assertEqual(differ.attendeeDiff(attendee), result, msg=description)
+            self.assertEqual(differ.attendeeMerge(attendee), result, msg=description)

Modified: CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/test/test_itip.py
===================================================================
--- CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/test/test_itip.py	2008-08-19 19:09:10 UTC (rev 2835)
+++ CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/scheduling/test/test_itip.py	2008-08-20 19:47:16 UTC (rev 2836)
@@ -14,11 +14,14 @@
 # limitations under the License.
 ##
 
+from dateutil.tz import tzutc
 from twistedcaldav.ical import Component
+from twistedcaldav.scheduling.itip import iTipProcessing, iTipGenerator
+import datetime
+import os
 import twistedcaldav.test.util
-from twistedcaldav.scheduling.itip import iTipProcessing
 
-class iTIP (twistedcaldav.test.util.TestCase):
+class iTIPProcessing (twistedcaldav.test.util.TestCase):
     """
     iCalendar support tests
     """
@@ -578,3 +581,495 @@
 #            print str(result)
             self.assertEqual(str(calendar).replace("\r", ""), str(result), msg=description)
 
+class iTIPGenerator (twistedcaldav.test.util.TestCase):
+    """
+    iCalendar support tests
+    """
+    data_dir = os.path.join(os.path.dirname(__file__), "data")
+
+    def test_request(self):
+        
+        data = (
+            # Simple component, no Attendees - no filtering
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REQUEST
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+END:VEVENT
+END:VCALENDAR
+""",
+                ()
+            ),
+
+            # Simple component, no Attendees - filtering
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-2
+DTSTART:20071114T000000Z
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REQUEST
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+END:VCALENDAR
+""",
+                ("mailto:user01 at example.com",)
+            ),
+
+            # Simple component, with one attendee - filtering match
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-3
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REQUEST
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-3
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                ("mailto:user2 at example.com",)
+            ),
+
+            # Simple component, with one attendee - no filtering match
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-4
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REQUEST
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+END:VCALENDAR
+""",
+                ("mailto:user3 at example.com",)
+            ),
+
+            # Recurring component with one instance, each with one attendee - filtering match
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-3
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+RRULE:FREQ=YEARLY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20081114T000000Z
+DTSTART:20071114T010000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REQUEST
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-3
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+RRULE:FREQ=YEARLY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20081114T000000Z
+DTSTART:20071114T010000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                ("mailto:user2 at example.com",)
+            ),
+
+            # Recurring component with one instance, each with one attendee - no filtering match
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-4
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+RRULE:FREQ=YEARLY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20081114T000000Z
+DTSTART:20071114T010000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REQUEST
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+END:VCALENDAR
+""",
+                ("mailto:user3 at example.com",)
+            ),        
+
+            # Recurring component with one instance, master with one attendee, instance without attendee - filtering match
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-3
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+RRULE:FREQ=YEARLY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20081114T000000Z
+DTSTART:20071114T010000Z
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REQUEST
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-3
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+EXDATE:20081114T000000Z
+ORGANIZER:mailto:user1 at example.com
+RRULE:FREQ=YEARLY
+END:VEVENT
+END:VCALENDAR
+""",
+                ("mailto:user2 at example.com",)
+            ),
+
+            # Recurring component with one instance, master with one attendee, instance without attendee - no filtering match
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-4
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+RRULE:FREQ=YEARLY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20081114T000000Z
+DTSTART:20071114T010000Z
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REQUEST
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+END:VCALENDAR
+""",
+                ("mailto:user3 at example.com",)
+            ),
+
+            # Recurring component with one instance, master without attendee, instance with attendee - filtering match
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-3
+DTSTART:20071114T000000Z
+ORGANIZER:mailto:user1 at example.com
+RRULE:FREQ=YEARLY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20081114T000000Z
+DTSTART:20071114T010000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REQUEST
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20081114T000000Z
+DTSTART:20071114T010000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                ("mailto:user2 at example.com",)
+            ),
+
+            # Recurring component with one instance, master without attendee, instance with attendee - no filtering match
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-4
+DTSTART:20071114T000000Z
+ORGANIZER:mailto:user1 at example.com
+RRULE:FREQ=YEARLY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20081114T000000Z
+DTSTART:20071114T010000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:REQUEST
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+END:VCALENDAR
+""",
+                ("mailto:user3 at example.com",)
+            ),
+        )
+        
+        for original, filtered, attendees in data:
+            component = Component.fromString(original)
+            itipped = iTipGenerator.generateAttendeeRequest(component, attendees)
+            self.assertEqual(filtered, str(itipped).replace("\r", ""))
+
+    def test_cancel(self):
+        
+        data = (
+            # Simple component, with two attendees - cancel one
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ATTENDEE:mailto:user3 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:CANCEL
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-1
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+SEQUENCE:1
+END:VEVENT
+END:VCALENDAR
+""",
+                ("mailto:user2 at example.com",),
+                (None,),
+            ),
+
+            # Simple component, with two attendees - cancel two
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-2
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ATTENDEE:mailto:user3 at example.com
+ORGANIZER:mailto:user1 at example.com
+SEQUENCE:1
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:CANCEL
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-2
+ATTENDEE:mailto:user3 at example.com
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+SEQUENCE:2
+END:VEVENT
+END:VCALENDAR
+""",
+                ("mailto:user3 at example.com", "mailto:user2 at example.com",),
+                (None,)
+            ),
+
+            # Recurring component with no instance, one attendee - cancel instance
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-3
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+RRULE:FREQ=YEARLY
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:CANCEL
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-3
+RECURRENCE-ID:20081114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+SEQUENCE:1
+END:VEVENT
+END:VCALENDAR
+""",
+                ("mailto:user2 at example.com",),
+                (datetime.datetime(2008, 11, 14, 0, 0, tzinfo=tzutc()), ),
+            ),
+
+            # Recurring component with one instance, each with one attendee - cancel instance
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-4
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+RRULE:FREQ=YEARLY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-4
+RECURRENCE-ID:20081114T000000Z
+DTSTART:20071114T010000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:CANCEL
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-4
+RECURRENCE-ID:20081114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+SEQUENCE:1
+END:VEVENT
+END:VCALENDAR
+""",
+                ("mailto:user2 at example.com",),
+                (datetime.datetime(2008, 11, 14, 0, 0, tzinfo=tzutc()), ),
+            ),
+
+            # Recurring component with one instance, each with one attendee - cancel master
+            (
+                """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-5
+DTSTART:20071114T000000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+RRULE:FREQ=YEARLY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890-5
+RECURRENCE-ID:20081114T000000Z
+DTSTART:20071114T010000Z
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",
+                """BEGIN:VCALENDAR
+VERSION:2.0
+METHOD:CANCEL
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890-5
+ATTENDEE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+SEQUENCE:1
+END:VEVENT
+END:VCALENDAR
+""",
+                ("mailto:user2 at example.com",),
+                (None, ),
+            ),
+        )
+        
+        for original, filtered, attendees, instances in data:
+            component = Component.fromString(original)
+            itipped = iTipGenerator.generateCancel(component, attendees, instances)
+            itipped = str(itipped).replace("\r", "")
+            itipped = "".join([line for line in itipped.splitlines(True) if not line.startswith("DTSTAMP:")])
+            self.assertEqual(filtered, itipped)

Deleted: CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/test/test_itip.py
===================================================================
--- CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/test/test_itip.py	2008-08-19 19:09:10 UTC (rev 2835)
+++ CalendarServer/branches/users/cdaboo/implicit-2805/twistedcaldav/test/test_itip.py	2008-08-20 19:47:16 UTC (rev 2836)
@@ -1,515 +0,0 @@
-##
-# Copyright (c) 2005-2007 Apple Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##
-
-from twistedcaldav.ical import Component
-from twistedcaldav.itip import iTipGenerator
-import twistedcaldav.test.util
-from dateutil.tz import tzutc
-import datetime
-import os
-
-class iTIPGenerator (twistedcaldav.test.util.TestCase):
-    """
-    iCalendar support tests
-    """
-    data_dir = os.path.join(os.path.dirname(__file__), "data")
-
-    def test_request(self):
-        
-        data = (
-            # Simple component, no Attendees - no filtering
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:REQUEST
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-END:VEVENT
-END:VCALENDAR
-""",
-                ()
-            ),
-
-            # Simple component, no Attendees - filtering
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-2
-DTSTART:20071114T000000Z
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:REQUEST
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-END:VCALENDAR
-""",
-                ("mailto:user01 at example.com",)
-            ),
-
-            # Simple component, with one attendee - filtering match
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-3
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:REQUEST
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-3
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                ("mailto:user2 at example.com",)
-            ),
-
-            # Simple component, with one attendee - no filtering match
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-4
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:REQUEST
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-END:VCALENDAR
-""",
-                ("mailto:user3 at example.com",)
-            ),
-
-            # Recurring component with one instance, each with one attendee - filtering match
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-3
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-RRULE:FREQ=YEARLY
-END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890
-RECURRENCE-ID:20081114T000000Z
-DTSTART:20071114T010000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:REQUEST
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-3
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-RRULE:FREQ=YEARLY
-END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890
-RECURRENCE-ID:20081114T000000Z
-DTSTART:20071114T010000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                ("mailto:user2 at example.com",)
-            ),
-
-            # Recurring component with one instance, each with one attendee - no filtering match
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-4
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-RRULE:FREQ=YEARLY
-END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890
-RECURRENCE-ID:20081114T000000Z
-DTSTART:20071114T010000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:REQUEST
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-END:VCALENDAR
-""",
-                ("mailto:user3 at example.com",)
-            ),        
-
-            # Recurring component with one instance, master with one attendee, instance without attendee - filtering match
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-3
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-RRULE:FREQ=YEARLY
-END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890
-RECURRENCE-ID:20081114T000000Z
-DTSTART:20071114T010000Z
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:REQUEST
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-3
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-EXDATE:20081114T000000Z
-ORGANIZER:mailto:user1 at example.com
-RRULE:FREQ=YEARLY
-END:VEVENT
-END:VCALENDAR
-""",
-                ("mailto:user2 at example.com",)
-            ),
-
-            # Recurring component with one instance, master with one attendee, instance without attendee - no filtering match
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-4
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-RRULE:FREQ=YEARLY
-END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890
-RECURRENCE-ID:20081114T000000Z
-DTSTART:20071114T010000Z
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:REQUEST
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-END:VCALENDAR
-""",
-                ("mailto:user3 at example.com",)
-            ),
-
-            # Recurring component with one instance, master without attendee, instance with attendee - filtering match
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-3
-DTSTART:20071114T000000Z
-ORGANIZER:mailto:user1 at example.com
-RRULE:FREQ=YEARLY
-END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890
-RECURRENCE-ID:20081114T000000Z
-DTSTART:20071114T010000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:REQUEST
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890
-RECURRENCE-ID:20081114T000000Z
-DTSTART:20071114T010000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                ("mailto:user2 at example.com",)
-            ),
-
-            # Recurring component with one instance, master without attendee, instance with attendee - no filtering match
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-4
-DTSTART:20071114T000000Z
-ORGANIZER:mailto:user1 at example.com
-RRULE:FREQ=YEARLY
-END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890
-RECURRENCE-ID:20081114T000000Z
-DTSTART:20071114T010000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:REQUEST
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-END:VCALENDAR
-""",
-                ("mailto:user3 at example.com",)
-            ),
-        )
-        
-        for original, filtered, attendees in data:
-            component = Component.fromString(original)
-            itipped = iTipGenerator.generateAttendeeRequest(component, attendees)
-            self.assertEqual(filtered, str(itipped).replace("\r", ""))
-
-    def test_cancel(self):
-        
-        data = (
-            # Simple component, with two attendees - cancel one
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ATTENDEE:mailto:user3 at example.com
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:CANCEL
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-1
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-SEQUENCE:1
-END:VEVENT
-END:VCALENDAR
-""",
-                ("mailto:user2 at example.com",),
-                (None,),
-            ),
-
-            # Simple component, with two attendees - cancel two
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-2
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ATTENDEE:mailto:user3 at example.com
-ORGANIZER:mailto:user1 at example.com
-SEQUENCE:1
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:CANCEL
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-2
-ATTENDEE:mailto:user3 at example.com
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-SEQUENCE:2
-END:VEVENT
-END:VCALENDAR
-""",
-                ("mailto:user3 at example.com", "mailto:user2 at example.com",),
-                (None,)
-            ),
-
-            # Recurring component with no instance, one attendee - cancel instance
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-3
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-RRULE:FREQ=YEARLY
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:CANCEL
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-3
-RECURRENCE-ID:20081114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-SEQUENCE:1
-END:VEVENT
-END:VCALENDAR
-""",
-                ("mailto:user2 at example.com",),
-                (datetime.datetime(2008, 11, 14, 0, 0, tzinfo=tzutc()), ),
-            ),
-
-            # Recurring component with one instance, each with one attendee - cancel instance
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-4
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-RRULE:FREQ=YEARLY
-END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890-4
-RECURRENCE-ID:20081114T000000Z
-DTSTART:20071114T010000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:CANCEL
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-4
-RECURRENCE-ID:20081114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-SEQUENCE:1
-END:VEVENT
-END:VCALENDAR
-""",
-                ("mailto:user2 at example.com",),
-                (datetime.datetime(2008, 11, 14, 0, 0, tzinfo=tzutc()), ),
-            ),
-
-            # Recurring component with one instance, each with one attendee - cancel master
-            (
-                """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-5
-DTSTART:20071114T000000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-RRULE:FREQ=YEARLY
-END:VEVENT
-BEGIN:VEVENT
-UID:12345-67890-5
-RECURRENCE-ID:20081114T000000Z
-DTSTART:20071114T010000Z
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-END:VEVENT
-END:VCALENDAR
-""",
-                """BEGIN:VCALENDAR
-VERSION:2.0
-METHOD:CANCEL
-PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
-BEGIN:VEVENT
-UID:12345-67890-5
-ATTENDEE:mailto:user2 at example.com
-ORGANIZER:mailto:user1 at example.com
-SEQUENCE:1
-END:VEVENT
-END:VCALENDAR
-""",
-                ("mailto:user2 at example.com",),
-                (None, ),
-            ),
-        )
-        
-        for original, filtered, attendees, instances in data:
-            component = Component.fromString(original)
-            itipped = iTipGenerator.generateCancel(component, attendees, instances)
-            itipped = str(itipped).replace("\r", "")
-            itipped = "".join([line for line in itipped.splitlines(True) if not line.startswith("DTSTAMP:")])
-            self.assertEqual(filtered, itipped)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080820/519a3581/attachment-0001.html 


More information about the calendarserver-changes mailing list