[CalendarServer-changes] [9240] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed May 9 18:52:10 PDT 2012


Revision: 9240
          http://trac.macosforge.org/projects/calendarserver/changeset/9240
Author:   cdaboo at apple.com
Date:     2012-05-09 18:52:08 -0700 (Wed, 09 May 2012)
Log Message:
-----------
Fix calverify result logging and unit tests causing failures for tests in a particular order.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/calverify.py
    CalendarServer/trunk/calendarserver/tools/test/test_calverify.py
    CalendarServer/trunk/calendarserver/tools/test/test_export.py
    CalendarServer/trunk/twistedcaldav/test/test_resource.py
    CalendarServer/trunk/twistedcaldav/test/test_wrapping.py
    CalendarServer/trunk/twistedcaldav/test/util.py

Modified: CalendarServer/trunk/calendarserver/tools/calverify.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/calverify.py	2012-05-09 23:52:06 UTC (rev 9239)
+++ CalendarServer/trunk/calendarserver/tools/calverify.py	2012-05-10 01:52:08 UTC (rev 9240)
@@ -954,8 +954,10 @@
             
             # Get attendee states for matching UID
             eachAttendeesOwnStatus = {}
+            attendeeCreatedModified = {}
             for attendeeEvent in self.attended_byuid.get(uid, ()):
                 owner, attresid, attuid, _ignore_md5, _ignore_organizer, att_created, att_modified = attendeeEvent
+                attendeeCreatedModified[owner] = (att_created, att_modified,)
                 calendar = yield self.getCalendar(attresid)
                 if calendar is None:
                     continue
@@ -975,15 +977,17 @@
                 # Double check the missing attendee situation in case we missed it during the original query
                 if organizerAttendee not in eachAttendeesOwnStatus:
                     # Try to reload the attendee data
-                    calendar, attresid = yield self.getCalendarForOwnerByUID(organizerAttendee, uid)
+                    calendar, attresid, att_created, att_modified = yield self.getCalendarForOwnerByUID(organizerAttendee, uid)
                     if calendar is not None:
                         eachAttendeesOwnStatus[organizerAttendee] = self.buildAttendeeStates(calendar, self.start, self.end, attendee_only=organizerAttendee)
                         attendeeResIDs[(organizerAttendee, uid)] = attresid
+                        attendeeCreatedModified[organizerAttendee] = (att_created, att_modified,)
                         #print "Reloaded missing attendee data"
                      
                 # If an entry for the attendee exists, then check whether attendee status matches
                 if organizerAttendee in eachAttendeesOwnStatus:
                     attendeeOwnStatus = eachAttendeesOwnStatus[organizerAttendee].get(organizerAttendee, set())
+                    att_created, att_modified = attendeeCreatedModified[organizerAttendee]
 
                     if organizerViewOfStatus != attendeeOwnStatus:
                         # Check that the difference is only cancelled or declined on the organizers side
@@ -1469,7 +1473,7 @@
         
         kwds = { "OWNER" : owner, "UID": uid }
         rows = (yield Select(
-            [co.ICALENDAR_TEXT, co.RESOURCE_ID,],
+            [co.ICALENDAR_TEXT, co.RESOURCE_ID, co.CREATED, co.MODIFIED,],
             From=ch.join(
                 cb, type="inner", on=(ch.RESOURCE_ID == cb.CALENDAR_HOME_RESOURCE_ID)).join(
                 co, type="inner", on=(cb.CALENDAR_RESOURCE_ID == co.CALENDAR_RESOURCE_ID).And(
@@ -1481,9 +1485,9 @@
         try:
             caldata = PyCalendar.parseText(rows[0][0]) if rows else None
         except PyCalendarError:
-            returnValue((None, None,))
+            returnValue((None, None, None, None,))
 
-        returnValue((caldata, rows[0][1] if rows else None,))
+        returnValue((caldata, rows[0][1], rows[0][2], rows[0][3],) if rows else (None, None, None, None,))
 
 
     def masterComponent(self, calendar):

Modified: CalendarServer/trunk/calendarserver/tools/test/test_calverify.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/test_calverify.py	2012-05-09 23:52:06 UTC (rev 9239)
+++ CalendarServer/trunk/calendarserver/tools/test/test_calverify.py	2012-05-10 01:52:08 UTC (rev 9240)
@@ -41,10 +41,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:OK
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 END:VEVENT
@@ -59,10 +59,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:BAD1
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 SEQUENCE:2
 END:VEVENT
 END:VCALENDAR
@@ -76,10 +76,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:BAD2
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 RRULE:FREQ=DAILY;COUNT=3
 SEQUENCE:2
@@ -87,11 +87,11 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:BAD2
-RECURRENCE-ID:20000307T120000Z
-DTEND:20000307T151500Z
+RECURRENCE-ID:20100307T120000Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 END:VEVENT
@@ -106,10 +106,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:BAD2
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 RRULE:FREQ=DAILY;COUNT=3
 SEQUENCE:2
@@ -117,11 +117,11 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:BAD2
-RECURRENCE-ID:20000307T120000Z
-DTEND:20000307T151500Z
+RECURRENCE-ID:20100307T120000Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 END:VEVENT
@@ -136,10 +136,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:BAD3
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 RRULE:FREQ=DAILY;COUNT=3
 SEQUENCE:2
@@ -147,11 +147,11 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:BAD3
-RECURRENCE-ID:20000307T111500Z
-DTEND:20000307T151500Z
+RECURRENCE-ID:20100307T111500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:mailto:example2 at example.com
@@ -169,10 +169,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:BAD4
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 ORGANIZER:http://demo.com:8008/principals/__uids__/D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
 ATTENDEE:mailto:example1 at example.com
@@ -191,10 +191,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:BAD5
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 ORGANIZER:mailto:example1 at example.com
 ATTENDEE:http://demo.com:8008/principals/__uids__/D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -213,10 +213,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:BAD6
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 ORGANIZER:http://demo.com:8008/principals/__uids__/D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
 ATTENDEE:http://demo.com:8008/principals/__uids__/D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -235,10 +235,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:BAD7
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 ORGANIZER;CALENDARSERVER-OLD-CUA="http://demo.com:8008/principals/__uids__/
  D46F3D71-04B7-43C2-A7B6-6F92F92E61D0":urn:uuid:D46F3D71-04B7-43C2-A7B6-6F9
@@ -261,10 +261,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:OK8
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 ORGANIZER;CALENDARSERVER-OLD-CUA="base64-aHR0cDovL2RlbW8uY29tOjgwMDgvcHJpbm
  NpcGFscy9fX3VpZHNfXy9ENDZGM0Q3MS0wNEI3LTQzQzItQTdCNi02RjkyRjkyRTYxRDA=":
@@ -916,10 +916,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISSING_ATTENDEE_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -938,10 +938,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISSING_ORGANIZER_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -959,10 +959,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISSING_ORGANIZER_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -981,10 +981,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH_ATTENDEE_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1002,10 +1002,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH_ATTENDEE_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1023,10 +1023,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH_ATTENDEE_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1045,10 +1045,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH2_ATTENDEE_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1066,7 +1066,7 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH2_ATTENDEE_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
 DTSTART:19990307T111500Z
@@ -1087,7 +1087,7 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH2_ATTENDEE_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
 DTSTART:19990307T111500Z
@@ -1109,7 +1109,7 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH_ORGANIZER_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
 DTSTART:19990307T111500Z
@@ -1130,10 +1130,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH_ORGANIZER_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1152,10 +1152,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH3_ATTENDEE_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1173,10 +1173,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH3_ATTENDEE_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1193,10 +1193,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH3_ATTENDEE_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:47B16BB4-DB5F-4BF6-85FE-A7DA54230F92
@@ -1212,10 +1212,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH_ORGANIZER_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1234,10 +1234,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH2_ORGANIZER_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1254,10 +1254,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH2_ORGANIZER_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1274,10 +1274,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH2_ORGANIZER_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1352,7 +1352,7 @@
         }
         output = StringIO()
         calverify = CalVerifyService(self._sqlCalendarStore, options, output, reactor, config)
-        yield calverify.doScan(False, True, False, start=PyCalendarDateTime(2000, 1, 1, 0, 0, 0))
+        yield calverify.doScan(False, True, False, start=PyCalendarDateTime(2010, 1, 1, 0, 0, 0))
 
         self.assertEqual(calverify.results["Number of events to process"], 15)
         self.assertEqual(calverify.results["Missing Attendee"], set((
@@ -1417,7 +1417,7 @@
         }
         output = StringIO()
         calverify = CalVerifyService(self._sqlCalendarStore, options, output, reactor, config)
-        yield calverify.doScan(False, True, True, start=PyCalendarDateTime(2000, 1, 1, 0, 0, 0))
+        yield calverify.doScan(False, True, True, start=PyCalendarDateTime(2010, 1, 1, 0, 0, 0))
 
         self.assertEqual(calverify.results["Number of events to process"], 15)
         self.assertEqual(calverify.results["Missing Attendee"], set((
@@ -1493,7 +1493,7 @@
         # Re-scan after changes to make sure there are no errors
         self.commit()
         calverify = CalVerifyService(self._sqlCalendarStore, options, output, reactor, config)
-        yield calverify.doScan(False, True, False, start=PyCalendarDateTime(2000, 1, 1, 0, 0, 0))
+        yield calverify.doScan(False, True, False, start=PyCalendarDateTime(2010, 1, 1, 0, 0, 0))
 
         self.assertEqual(calverify.results["Number of events to process"], 14)
         self.assertTrue("Missing Attendee" not in calverify.results)
@@ -1519,10 +1519,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISSING_ATTENDEE_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1532,27 +1532,6 @@
 END:VCALENDAR
 """.replace("\n", "\r\n")
 
-    # Attendee has event, organizer does not
-    MISSING_ORGANIZER_L1_ICS = """BEGIN:VCALENDAR
-VERSION:2.0
-PRODID:-//Apple Inc.//iCal 4.0.1//EN
-CALSCALE:GREGORIAN
-BEGIN:VEVENT
-CREATED:20100303T181216Z
-UID:MISSING_ORGANIZER_ICS
-DTEND:20000307T151500Z
-TRANSP:OPAQUE
-SUMMARY:Ancient event
-DTSTART:20000307T111500Z
-DTSTAMP:20100303T181220Z
-SEQUENCE:2
-ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
-ATTENDEE:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
-ATTENDEE:urn:uuid:75EA36BE-F71B-40F9-81F9-CF59BF40CA8F
-END:VEVENT
-END:VCALENDAR
-""".replace("\n", "\r\n")
-
     # Attendee partstat mismatch
     MISMATCH_ATTENDEE_1_ICS = """BEGIN:VCALENDAR
 VERSION:2.0
@@ -1561,10 +1540,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH_ATTENDEE_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1581,10 +1560,10 @@
 BEGIN:VEVENT
 CREATED:20100303T181216Z
 UID:MISMATCH_ATTENDEE_ICS
-DTEND:20000307T151500Z
+DTEND:20100307T151500Z
 TRANSP:OPAQUE
 SUMMARY:Ancient event
-DTSTART:20000307T111500Z
+DTSTART:20100307T111500Z
 DTSTAMP:20100303T181220Z
 SEQUENCE:2
 ORGANIZER:urn:uuid:D46F3D71-04B7-43C2-A7B6-6F92F92E61D0
@@ -1643,7 +1622,7 @@
         }
         output = StringIO()
         calverify = CalVerifyService(self._sqlCalendarStore, options, output, reactor, config)
-        yield calverify.doScan(False, True, False, start=PyCalendarDateTime(2000, 1, 1, 0, 0, 0))
+        yield calverify.doScan(False, True, False, start=PyCalendarDateTime(2010, 1, 1, 0, 0, 0))
 
         self.assertEqual(calverify.results["Number of events to process"], 3)
         self.assertEqual(calverify.results["Missing Attendee"], set((
@@ -1692,7 +1671,7 @@
         }
         output = StringIO()
         calverify = CalVerifyService(self._sqlCalendarStore, options, output, reactor, config)
-        yield calverify.doScan(False, True, True, start=PyCalendarDateTime(2000, 1, 1, 0, 0, 0))
+        yield calverify.doScan(False, True, True, start=PyCalendarDateTime(2010, 1, 1, 0, 0, 0))
 
         self.assertEqual(calverify.results["Number of events to process"], 3)
         self.assertEqual(calverify.results["Missing Attendee"], set((
@@ -1720,11 +1699,12 @@
         self.assertTrue("Fix remove" not in calverify.results)
 
         self.assertEqual(calverify.results["Fix failures"], 0)
-        self.assertEqual(calverify.results["Fixed Auto-Accepts"][0]["path"], "/calendars/__uids__/%s/calendar/mismatched_attendee.ics" % self.uuidl1)
-        self.assertEqual(calverify.results["Fixed Auto-Accepts"][0]["uid"], "MISMATCH_ATTENDEE_ICS")
-        self.assertEqual(calverify.results["Fixed Auto-Accepts"][0]["start"].getText(), "20000307T031500")
-        self.assertEqual(calverify.results["Fixed Auto-Accepts"][1]["uid"], "MISSING_ATTENDEE_ICS")
-        self.assertEqual(calverify.results["Fixed Auto-Accepts"][1]["start"].getText(), "20000307T031500")
+        testResults = sorted(calverify.results["Fixed Auto-Accepts"], key=lambda x:x["uid"])
+        self.assertEqual(testResults[0]["path"], "/calendars/__uids__/%s/calendar/mismatched_attendee.ics" % self.uuidl1)
+        self.assertEqual(testResults[0]["uid"], "MISMATCH_ATTENDEE_ICS")
+        self.assertEqual(testResults[0]["start"].getText(), "20100307T031500")
+        self.assertEqual(testResults[1]["uid"], "MISSING_ATTENDEE_ICS")
+        self.assertEqual(testResults[1]["start"].getText(), "20100307T031500")
 
         sync_token_new1 = (yield (yield self.calendarUnderTest(self.uuid1)).syncToken())
         sync_token_newl1 = (yield (yield self.calendarUnderTest(self.uuidl1)).syncToken())
@@ -1734,7 +1714,7 @@
         # Re-scan after changes to make sure there are no errors
         self.commit()
         calverify = CalVerifyService(self._sqlCalendarStore, options, output, reactor, config)
-        yield calverify.doScan(False, True, False, start=PyCalendarDateTime(2000, 1, 1, 0, 0, 0))
+        yield calverify.doScan(False, True, False, start=PyCalendarDateTime(2010, 1, 1, 0, 0, 0))
 
         self.assertEqual(calverify.results["Number of events to process"], 4)
         self.assertTrue("Missing Attendee" not in calverify.results)

Modified: CalendarServer/trunk/calendarserver/tools/test/test_export.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/test_export.py	2012-05-09 23:52:06 UTC (rev 9239)
+++ CalendarServer/trunk/calendarserver/tools/test/test_export.py	2012-05-10 01:52:08 UTC (rev 9240)
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 ##
+from twistedcaldav.config import config
 
 """
 Unit tests for L{calendarsever.tools.export}.
@@ -38,7 +39,6 @@
 from calendarserver.tools.export import DirectoryExporter, UIDExporter
 
 from twisted.python.filepath import FilePath
-from twistedcaldav.test.util import patchConfig
 from twisted.internet.defer import Deferred
 
 from txdav.common.datastore.test.util import buildStore
@@ -216,22 +216,23 @@
             raise RuntimeError(
                 "Main called twice during this test; duplicate reactor run.")
 
-        patchConfig(
-            self,
-            DirectoryService=dict(
-                type="twistedcaldav.directory.xmlfile.XMLDirectoryService",
-                params=dict(
-                    xmlFile=self.accountsFile
-                )
-            ),
-            ResourceService=dict(Enabled=False),
-            AugmentService=dict(
-                type="twistedcaldav.directory.augment.AugmentXMLDB",
-                params=dict(
-                    xmlFiles=[self.augmentsFile]
-                )
+        self.patch(config, "DirectoryService", dict(
+            type="twistedcaldav.directory.xmlfile.XMLDirectoryService",
+            params=dict(
+                xmlFile=self.accountsFile
             )
-        )
+        ))
+        self.patch(config, "ResourceService", dict(
+            Enabled=False,
+            type="twistedcaldav.directory.xmlfile.XMLDirectoryService",
+            params=dict()
+        ))
+        self.patch(config, "AugmentService", dict(
+            type="twistedcaldav.directory.augment.AugmentXMLDB",
+            params=dict(
+                xmlFiles=[self.augmentsFile]
+            )
+        ))
 
         self.mainCalled = True
         self.usedConfigFile = configFileName

Modified: CalendarServer/trunk/twistedcaldav/test/test_resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_resource.py	2012-05-09 23:52:06 UTC (rev 9239)
+++ CalendarServer/trunk/twistedcaldav/test/test_resource.py	2012-05-10 01:52:08 UTC (rev 9240)
@@ -26,7 +26,6 @@
  CalendarHomeResource, AddressBookHomeResource
 from twistedcaldav.test.util import InMemoryPropertyStore
 from twistedcaldav.test.util import TestCase
-from twistedcaldav.test.util import patchConfig
 
 
 class StubProperty(object):
@@ -186,7 +185,7 @@
         L{AdminPrincipals} list.
         """
         theAdmin = "/read-write-admin/"
-        patchConfig(self, AdminPrincipals=[theAdmin])
+        self.patch(config, "AdminPrincipals", [theAdmin])
         site = None
         request = SimpleRequest(site, "GET", "/not/a/real/url/")
         request.authzUser = request.authnUser = Principal(HRef(theAdmin))
@@ -203,7 +202,7 @@
         L{AdminPrincipals} list.
         """
         theAdmin = "/read-only-admin/"
-        patchConfig(self, ReadPrincipals=[theAdmin])
+        self.patch(config, "ReadPrincipals", [theAdmin])
         site = None
         request = SimpleRequest(site, "GET", "/not/a/real/url/")
         request.authzUser = request.authnUser = Principal(HRef(theAdmin))

Modified: CalendarServer/trunk/twistedcaldav/test/test_wrapping.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_wrapping.py	2012-05-09 23:52:06 UTC (rev 9239)
+++ CalendarServer/trunk/twistedcaldav/test/test_wrapping.py	2012-05-10 01:52:08 UTC (rev 9240)
@@ -50,7 +50,6 @@
 from twext.web2.responsecode import INSUFFICIENT_STORAGE_SPACE
 from twext.web2.stream import MemoryStream
 from txdav.common.datastore.test.util import deriveQuota
-from twistedcaldav.test.util import patchConfig
 from twistedcaldav.directory.test.test_xmlfile import XMLFileBase
 from txdav.caldav.icalendarstore import ICalendarHome
 from txdav.carddav.iaddressbookstore import IAddressBookHome
@@ -399,7 +398,7 @@
         """
         Exceeding quota on an attachment returns an HTTP error code.
         """
-        patchConfig(testCase=self, EnableDropBox=True)
+        self.patch(config, "EnableDropBox", True)
         yield self.populateOneObject("1.ics", test_event_text)
         calendarObject = yield self.getResource(
             "/calendars/users/wsanchez/dropbox/uid-test.dropbox/too-big-attachment",

Modified: CalendarServer/trunk/twistedcaldav/test/util.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/util.py	2012-05-09 23:52:06 UTC (rev 9239)
+++ CalendarServer/trunk/twistedcaldav/test/util.py	2012-05-10 01:52:08 UTC (rev 9240)
@@ -606,21 +606,6 @@
 
 
 
-def patchConfig(testCase, **kw):
-    """
-    Patch the global configuration (including running the appropriate hooks) for
-    the duration of the given test.
-    """
-    preserved = {}
-    for k in kw:
-        preserved[k] = config.get(k, None)
-    def reUpdate():
-        config.update(preserved)
-    testCase.addCleanup(reUpdate)
-    config.update(kw)
-
-
-
 class ErrorOutput(Exception):
     """
     The process produced some error output and exited with a non-zero exit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120509/ddbdbb26/attachment-0001.html>


More information about the calendarserver-changes mailing list