[CalendarServer-changes] [13372] CalendarServer/trunk/txdav

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 25 08:15:25 PDT 2014


Revision: 13372
          http://trac.calendarserver.org//changeset/13372
Author:   cdaboo at apple.com
Date:     2014-04-25 08:15:25 -0700 (Fri, 25 Apr 2014)
Log Message:
-----------
Fix group member ordering test issues.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/sql.py
    CalendarServer/trunk/txdav/who/test/test_group_attendees.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/sql.py	2014-04-25 15:11:05 UTC (rev 13371)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql.py	2014-04-25 15:15:25 UTC (rev 13372)
@@ -1950,11 +1950,11 @@
             groupRecord = yield self.directoryService().recordWithCalendarUserAddress(groupCUA)
             if groupRecord:
                 members = yield groupRecord.expandedMembers()
-                groupCUAToAttendeeMemberPropMap[groupRecord.canonicalCalendarUserAddress()] = frozenset(
-                    [member.attendeeProperty(params={"MEMBER": groupCUA}) for member in members]
+                groupCUAToAttendeeMemberPropMap[groupRecord.canonicalCalendarUserAddress()] = tuple(
+                    [member.attendeeProperty(params={"MEMBER": groupCUA}) for member in sorted(members, key=lambda x: x.uid)]
                 )
             else:
-                groupCUAToAttendeeMemberPropMap[groupCUA] = frozenset()
+                groupCUAToAttendeeMemberPropMap[groupCUA] = ()
 
         # sync group attendee members if inserting or group changed
         changed = False

Modified: CalendarServer/trunk/txdav/who/test/test_group_attendees.py
===================================================================
--- CalendarServer/trunk/txdav/who/test/test_group_attendees.py	2014-04-25 15:11:05 UTC (rev 13371)
+++ CalendarServer/trunk/txdav/who/test/test_group_attendees.py	2014-04-25 15:15:25 UTC (rev 13372)
@@ -23,7 +23,7 @@
 from twisted.internet.defer import inlineCallbacks, returnValue
 from twisted.trial import unittest
 from twistedcaldav.config import config
-from twistedcaldav.ical import Component, normalize_iCalStr, ignoredComponents
+from twistedcaldav.ical import Component, normalize_iCalStr
 from txdav.caldav.datastore.test.util import buildCalendarStore, populateCalendarsFrom, CommonCommonTests
 from txdav.who.directory import CalendarDirectoryRecordMixin
 from txdav.who.groups import GroupCacher
@@ -94,25 +94,9 @@
 
 
     def _assertICalStrEqual(self, iCalStr1, iCalStr2):
-
-        def orderMemberValues(event):
-
-            for component in event.subcomponents():
-                if component.name() in ignoredComponents:
-                    continue
-
-                # remove all values and add them again
-                # this is sort of a hack, better pycalendar has ordering
-                for attendeeProp in tuple(component.properties("ATTENDEE")):
-                    if attendeeProp.hasParameter("MEMBER"):
-                        parameterValues = tuple(attendeeProp.parameterValues("MEMBER"))
-                        for paramterValue in parameterValues:
-                            attendeeProp.removeParameterValue("MEMBER", paramterValue)
-                        attendeeProp.setParameter("MEMBER", sorted(parameterValues))
-
         self.assertEqual(
-            orderMemberValues(Component.fromString(normalize_iCalStr(iCalStr1))),
-            orderMemberValues(Component.fromString(normalize_iCalStr(iCalStr2)))
+            normalize_iCalStr(iCalStr1),
+            normalize_iCalStr(Component.fromString(iCalStr2)),
         )
 
 
@@ -777,10 +761,10 @@
 ATTENDEE;CN=Group 01;CUTYPE=GROUP;EMAIL=group01 at example.com;RSVP=TRUE;SCHEDULE-STATUS=3.7:urn:x-uid:20000000-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
+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
 CREATED:20060101T150000Z
 ORGANIZER;CN=User 01;EMAIL=user01 at example.com:urn:x-uid:10000000-0000-0000-0000-000000000001
 SEQUENCE:2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140425/e227d104/attachment-0001.html>


More information about the calendarserver-changes mailing list