[CalendarServer-changes] [13351] CalendarServer/trunk/txdav/who

source_changes at macosforge.org source_changes at macosforge.org
Mon Apr 21 15:52:38 PDT 2014


Revision: 13351
          http://trac.calendarserver.org//changeset/13351
Author:   gaya at apple.com
Date:     2014-04-21 15:52:38 -0700 (Mon, 21 Apr 2014)
Log Message:
-----------
fix txdav.who.test.test_group_attendees.GroupAttendeeReconciliation.test_groupRemovalFromDirectory

Modified Paths:
--------------
    CalendarServer/trunk/txdav/who/groups.py
    CalendarServer/trunk/txdav/who/test/test_group_attendees.py

Modified: CalendarServer/trunk/txdav/who/groups.py
===================================================================
--- CalendarServer/trunk/txdav/who/groups.py	2014-04-21 19:55:16 UTC (rev 13350)
+++ CalendarServer/trunk/txdav/who/groups.py	2014-04-21 22:52:38 UTC (rev 13351)
@@ -351,8 +351,10 @@
                 # FIXME: Use schema's delete cascade
                 yield self.synchronizeMembers(txn, groupID, set())
                 yield txn.deleteGroup(groupID)
+                membershipChanged = True
 
-            wp = yield self.scheduleEventReconciliations(txn, groupID)
+            if membershipChanged:
+                wp = yield self.scheduleEventReconciliations(txn, groupID)
 
         returnValue(wp)
 

Modified: CalendarServer/trunk/txdav/who/test/test_group_attendees.py
===================================================================
--- CalendarServer/trunk/txdav/who/test/test_group_attendees.py	2014-04-21 19:55:16 UTC (rev 13350)
+++ CalendarServer/trunk/txdav/who/test/test_group_attendees.py	2014-04-21 22:52:38 UTC (rev 13351)
@@ -681,4 +681,140 @@
         This needs to make sure that an attendee in two groups is NOT removed if only one of
         those groups is removed
         """
-        self.fail("FIXME: need to implement this test")
+
+        yield self._verifyObjectResourceCount("10000000-0000-0000-0000-000000000006", 0)
+        yield self._verifyObjectResourceCount("10000000-0000-0000-0000-000000000007", 0)
+        yield self._verifyObjectResourceCount("10000000-0000-0000-0000-000000000008", 0)
+        yield self._verifyObjectResourceCount("10000000-0000-0000-0000-000000000009", 0)
+        yield self._verifyObjectResourceCount("10000000-0000-0000-0000-000000000010", 0)
+
+        calendar = yield self.calendarUnderTest(name="calendar", home="10000000-0000-0000-0000-000000000001")
+
+        data_put_1 = """BEGIN:VCALENDAR
+CALSCALE:GREGORIAN
+PRODID:-//Example Inc.//Example Calendar//EN
+VERSION:2.0
+BEGIN:VEVENT
+DTSTAMP:20051222T205953Z
+CREATED:20060101T150000Z
+DTSTART;TZID=US/Eastern:20140101T100000
+DURATION:PT1H
+SUMMARY:event 1
+UID:event1 at ninevah.local
+ORGANIZER:MAILTO:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE:MAILTO:group02 at example.com
+ATTENDEE:MAILTO:group03 at example.com
+END:VEVENT
+END:VCALENDAR"""
+
+        data_get_1 = """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Example Inc.//Example Calendar//EN
+BEGIN:VEVENT
+UID:event1 at ninevah.local
+DTSTART;TZID=US/Eastern:20140101T100000
+DURATION:PT1H
+ATTENDEE;CN=User 01;EMAIL=user01 at example.com;RSVP=TRUE:urn:x-uid:10000000-0000-0000-0000-000000000001
+ATTENDEE;CN=Group 02;CUTYPE=GROUP;EMAIL=group02 at example.com;RSVP=TRUE;SCHEDULE-STATUS=3.7:urn:x-uid:20000000-0000-0000-0000-000000000002
+ATTENDEE;CN=Group 03;CUTYPE=GROUP;EMAIL=group03 at example.com;RSVP=TRUE;SCHEDULE-STATUS=3.7:urn:x-uid:20000000-0000-0000-0000-000000000003
+ATTENDEE;CN=User 06;EMAIL=user06 at example.com;MEMBER="urn:x-uid:20000000-0000-0000-0000-000000000002";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:x-uid:10000000-0000-0000-0000-000000000006
+ATTENDEE;CN=User 07;EMAIL=user07 at example.com;MEMBER="urn:x-uid:20000000-0000-0000-0000-000000000002","urn:x-uid:20000000-0000-0000-0000-000000000003";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:x-uid:10000000-0000-0000-0000-000000000007
+ATTENDEE;CN=User 08;EMAIL=user08 at example.com;MEMBER="urn:x-uid:20000000-0000-0000-0000-000000000002","urn:x-uid:20000000-0000-0000-0000-000000000003";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:x-uid:10000000-0000-0000-0000-000000000008
+ATTENDEE;CN=User 09;EMAIL=user09 at example.com;MEMBER="urn:x-uid:20000000-0000-0000-0000-000000000003";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:x-uid:10000000-0000-0000-0000-000000000009
+CREATED:20060101T150000Z
+ORGANIZER;CN=User 01;EMAIL=user01 at example.com:urn:x-uid:10000000-0000-0000-0000-000000000001
+SUMMARY:event 1
+END:VEVENT
+END:VCALENDAR"""
+
+        data_put_2 = """BEGIN:VCALENDAR
+CALSCALE:GREGORIAN
+PRODID:-//Example Inc.//Example Calendar//EN
+VERSION:2.0
+BEGIN:VEVENT
+DTSTAMP:20051222T205953Z
+CREATED:20060101T150000Z
+DTSTART;TZID=US/Eastern:20140101T100000
+DURATION:PT1H
+SUMMARY:event 1
+UID:event1 at ninevah.local
+ORGANIZER:MAILTO:user01 at example.com
+ATTENDEE:mailto:user01 at example.com
+ATTENDEE:MAILTO:group02 at example.com
+END:VEVENT
+END:VCALENDAR"""
+
+        data_get_2 = """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Example Inc.//Example Calendar//EN
+BEGIN:VEVENT
+UID:event1 at ninevah.local
+DTSTART;TZID=US/Eastern:20140101T100000
+DURATION:PT1H
+ATTENDEE;CN=User 01;EMAIL=user01 at example.com;RSVP=TRUE:urn:x-uid:10000000-0000-0000-0000-000000000001
+ATTENDEE;CN=Group 02;CUTYPE=GROUP;EMAIL=group02 at example.com;RSVP=TRUE;SCHEDULE-STATUS=3.7:urn:x-uid:20000000-0000-0000-0000-000000000002
+ATTENDEE;CN=User 06;EMAIL=user06 at example.com;MEMBER="urn:x-uid:20000000-0000-0000-0000-000000000002";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:x-uid:10000000-0000-0000-0000-000000000006
+ATTENDEE;CN=User 07;EMAIL=user07 at example.com;MEMBER="urn:x-uid:20000000-0000-0000-0000-000000000002";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:x-uid:10000000-0000-0000-0000-000000000007
+ATTENDEE;CN=User 08;EMAIL=user08 at example.com;MEMBER="urn:x-uid:20000000-0000-0000-0000-000000000002";PARTSTAT=NEEDS-ACTION;RSVP=TRUE;SCHEDULE-STATUS=1.2:urn:x-uid:10000000-0000-0000-0000-000000000008
+CREATED:20060101T150000Z
+ORGANIZER;CN=User 01;EMAIL=user01 at example.com:urn:x-uid:10000000-0000-0000-0000-000000000001
+SEQUENCE:1
+SUMMARY:event 1
+END:VEVENT
+END:VCALENDAR
+"""
+
+        vcalendar1 = Component.fromString(data_put_1)
+        yield calendar.createCalendarObjectWithName("data1.ics", vcalendar1)
+        yield self.commit()
+
+        cobj1 = yield self.calendarObjectUnderTest(name="data1.ics", calendar_name="calendar", home="10000000-0000-0000-0000-000000000001")
+        vcalendar2 = yield cobj1.component()
+        self._assertICalStrEqual(vcalendar2, data_get_1)
+
+        yield self._verifyObjectResourceCount("10000000-0000-0000-0000-000000000006", 1)
+        yield self._verifyObjectResourceCount("10000000-0000-0000-0000-000000000007", 1)
+        yield self._verifyObjectResourceCount("10000000-0000-0000-0000-000000000008", 1)
+        yield self._verifyObjectResourceCount("10000000-0000-0000-0000-000000000009", 1)
+
+        # cache groups
+        groupCacher = GroupCacher(self.transactionUnderTest().directoryService())
+        wp = yield groupCacher.refreshGroup(self.transactionUnderTest(), "20000000-0000-0000-0000-000000000002")
+        yield self.commit()
+        yield wp.whenExecuted()
+        wp = yield groupCacher.refreshGroup(self.transactionUnderTest(), "20000000-0000-0000-0000-000000000003")
+        yield self.commit()
+        yield wp.whenExecuted()
+
+        cobj1 = yield self.calendarObjectUnderTest(name="data1.ics", calendar_name="calendar", home="10000000-0000-0000-0000-000000000001")
+        vcalendar3 = yield cobj1.component()
+        self._assertICalStrEqual(vcalendar3, data_get_1)
+
+        vcalendar4 = Component.fromString(data_put_2)
+        yield cobj1.setComponent(vcalendar4)
+        yield self.commit()
+
+        cobj1 = yield self.calendarObjectUnderTest(name="data1.ics", calendar_name="calendar", home="10000000-0000-0000-0000-000000000001")
+        vcalendar5 = yield cobj1.component()
+        self._assertICalStrEqual(vcalendar5, data_get_2)
+
+        yield self._verifyObjectResourceCount("10000000-0000-0000-0000-000000000006", 1)
+        yield self._verifyObjectResourceCount("10000000-0000-0000-0000-000000000007", 1)
+        yield self._verifyObjectResourceCount("10000000-0000-0000-0000-000000000008", 1)
+        yield self._verifyObjectResourceCount("10000000-0000-0000-0000-000000000009", 1)
+
+        # groups did not change so no work proposals
+        wp = yield groupCacher.refreshGroup(self.transactionUnderTest(), "20000000-0000-0000-0000-000000000002")
+        self.assertEqual(wp, None)
+        wp = yield groupCacher.refreshGroup(self.transactionUnderTest(), "20000000-0000-0000-0000-000000000003")
+        self.assertEqual(wp, None)
+
+        cal1 = yield self.calendarUnderTest(name="calendar", home="10000000-0000-0000-0000-000000000009")
+        cobjs = yield cal1.objectResources()
+        self.assertEqual(len(cobjs), 1)
+        comp1 = yield cobjs[0].componentForUser()
+        self.assertTrue("STATUS:CANCELLED" in str(comp1))
+        yield self.commit()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140421/ec7aa526/attachment.html>


More information about the calendarserver-changes mailing list