[CalendarServer-changes] [11767]
source_changes at macosforge.org
source_changes at macosforge.org
Mon Sep 30 16:51:10 PDT 2013
Revision: 11767
http://trac.calendarserver.org//changeset/11767
Author: gaya at apple.com
Date: 2013-09-30 16:51:10 -0700 (Mon, 30 Sep 2013)
Log Message:
-----------
add tests to sharing-sync.xml, fix AddressBook.resourceNamesSinceRevision()
Modified Paths:
--------------
CalDAVTester/branches/users/gaya/sharedgroupfixestester/scripts/tests/CardDAV/sharing-sync.xml
CalendarServer/branches/users/gaya/sharedgroupfixes/txdav/carddav/datastore/sql.py
Modified: CalDAVTester/branches/users/gaya/sharedgroupfixestester/scripts/tests/CardDAV/sharing-sync.xml
===================================================================
--- CalDAVTester/branches/users/gaya/sharedgroupfixestester/scripts/tests/CardDAV/sharing-sync.xml 2013-09-30 23:43:46 UTC (rev 11766)
+++ CalDAVTester/branches/users/gaya/sharedgroupfixestester/scripts/tests/CardDAV/sharing-sync.xml 2013-09-30 23:51:10 UTC (rev 11767)
@@ -38,7 +38,7 @@
</start>
<!-- test suite below is similar to test suite in ../CalDAV/sharing-sync.xml -->
- <test-suite name='shared addressbook' ignore='no'>
+ <test-suite name='shared addressbook' ignore='yes'>
<test name='1a' ignore='no'>
<description>Initial sync tokens</description>
<request print-response='no'>
@@ -1447,6 +1447,422 @@
</request>
</test>
<test name='10'>
+ <description>Sharer adds unshared vCard</description>
+ <request print-response='no'>
+ <method>PUT</method>
+ <ruri>$addressbookpath1:/2.vcf</ruri>
+ <data>
+ <content-type>text/vcard; charset=utf-8</content-type>
+ <filepath>Resource/CardDAV/sharing/sync/group-one/2.vcf</filepath>
+ </data>
+ <verify>
+ <callback>statusCode</callback>
+ </verify>
+ </request>
+ </test>
+ <test name='11a' ignore='no'>
+ <description>Updated tokens</description>
+ <request print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome1:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ <value>$addressbook:/</value>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken1:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='11b' ignore='no'>
+ <request print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome1:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ <value>$addressbook:/</value>
+ <value>$addressbook:/2.vcf</value>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken2:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='11c' ignore='no'>
+ <request print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookpath1:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ <value>2.vcf</value>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken3:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='11d' ignore='no'>
+ <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome2:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken4:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='11e' ignore='no'>
+ <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome2:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken5:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='11f' ignore='no'>
+ <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome2:/$userguid1:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken6:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='12'>
+ <description>Sharer changes unshared vCard</description>
+ <request print-response='no'>
+ <method>PUT</method>
+ <ruri>$addressbookpath1:/2.vcf</ruri>
+ <data>
+ <content-type>text/vcard; charset=utf-8</content-type>
+ <filepath>Resource/CardDAV/sharing/sync/group-one/2.vcf</filepath>
+ </data>
+ <verify>
+ <callback>statusCode</callback>
+ </verify>
+ </request>
+ </test>
+ <test name='13a' ignore='no'>
+ <description>Updated tokens</description>
+ <request print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome1:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ <value>$addressbook:/</value>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken1:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='15b' ignore='no'>
+ <request print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome1:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ <value>$addressbook:/</value>
+ <value>$addressbook:/2.vcf</value>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken2:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='15c' ignore='no'>
+ <request print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookpath1:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ <value>2.vcf</value>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken3:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='15d' ignore='no'>
+ <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome2:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken4:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='15e' ignore='no'>
+ <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome2:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken5:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='15f' ignore='no'>
+ <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome2:/$userguid1:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken6:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='14'>
+ <description>Sharer changes unshared vCard</description>
+ <request print-response='no'>
+ <method>DELETE</method>
+ <ruri>$addressbookpath1:/2.vcf</ruri>
+ <verify>
+ <callback>statusCode</callback>
+ </verify>
+ </request>
+ </test>
+ <test name='15a' ignore='no'>
+ <description>Updated tokens</description>
+ <request print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome1:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token1-level-1.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ <value>$addressbook:/</value>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken1:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='15b' ignore='no'>
+ <request print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome1:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token2-level-infinite.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ <value>$addressbook:/</value>
+ </arg>
+ <arg>
+ <name>badhrefs</name>
+ <value>$addressbook:/2.vcf</value>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken2:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='15c' ignore='no'>
+ <request print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookpath1:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token3-level-1.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>badhrefs</name>
+ <value>2.vcf</value>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken3:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='15d' ignore='no'>
+ <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome2:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token4-level-1.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken4:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='15e' ignore='no'>
+ <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome2:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token5-level-infinite.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken5:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='15f' ignore='no'>
+ <request user="$userid2:" pswd="$pswd2:" print-response='no'>
+ <method>REPORT</method>
+ <ruri>$addressbookhome2:/$userguid1:/</ruri>
+ <data substitutions='yes'>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/REPORT/sync-token6-level-1.xml</filepath>
+ </data>
+ <verify>
+ <callback>multistatusItems</callback>
+ <arg>
+ <name>okhrefs</name>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>/{DAV:}multistatus/{DAV:}sync-token</name>
+ <variable>$synctoken6:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='16'>
<description>Sharee deletes vcard</description>
<request user="$userid2:" pswd="$pswd2:" print-response='no'>
<method>DELETE</method>
@@ -1456,7 +1872,7 @@
</verify>
</request>
</test>
- <test name='11a' ignore='no'>
+ <test name='17a' ignore='no'>
<description>Updated tokens</description>
<request print-response='no'>
<method>REPORT</method>
@@ -1478,7 +1894,7 @@
</grabelement>
</request>
</test>
- <test name='11b' ignore='no'>
+ <test name='17b' ignore='no'>
<request print-response='no'>
<method>REPORT</method>
<ruri>$addressbookhome1:/</ruri>
@@ -1503,7 +1919,7 @@
</grabelement>
</request>
</test>
- <test name='11c' ignore='no'>
+ <test name='17c' ignore='no'>
<request print-response='no'>
<method>REPORT</method>
<ruri>$addressbookpath1:/</ruri>
@@ -1524,7 +1940,7 @@
</grabelement>
</request>
</test>
- <test name='11d' ignore='no'>
+ <test name='17d' ignore='no'>
<request user="$userid2:" pswd="$pswd2:" print-response='no'>
<method>REPORT</method>
<ruri>$addressbookhome2:/</ruri>
@@ -1545,7 +1961,7 @@
</grabelement>
</request>
</test>
- <test name='11e' ignore='no'>
+ <test name='17e' ignore='no'>
<request user="$userid2:" pswd="$pswd2:" print-response='no'>
<method>REPORT</method>
<ruri>$addressbookhome2:/</ruri>
@@ -1570,7 +1986,7 @@
</grabelement>
</request>
</test>
- <test name='11f' ignore='no'>
+ <test name='17f' ignore='no'>
<request user="$userid2:" pswd="$pswd2:" print-response='no'>
<method>REPORT</method>
<ruri>$addressbookhome2:/$userguid1:/</ruri>
@@ -1591,7 +2007,7 @@
</grabelement>
</request>
</test>
- <test name='12'>
+ <test name='18'>
<description>Sharer unshares</description>
<request print-response='no'>
<method>POST</method>
@@ -1605,7 +2021,7 @@
</verify>
</request>
</test>
- <test name='13a' ignore='no'>
+ <test name='19a' ignore='no'>
<description>Updated tokens</description>
<request print-response='no'>
<method>REPORT</method>
@@ -1627,7 +2043,7 @@
</grabelement>
</request>
</test>
- <test name='13b' ignore='no'>
+ <test name='19b' ignore='no'>
<request print-response='no'>
<method>REPORT</method>
<ruri>$addressbookhome1:/</ruri>
@@ -1648,7 +2064,7 @@
</grabelement>
</request>
</test>
- <test name='13c' ignore='no'>
+ <test name='19c' ignore='no'>
<request print-response='no'>
<method>REPORT</method>
<ruri>$addressbookpath1:/</ruri>
@@ -1665,7 +2081,7 @@
</grabelement>
</request>
</test>
- <test name='13e' ignore='no'>
+ <test name='19e' ignore='no'>
<request user="$userid2:" pswd="$pswd2:" print-response='no'>
<method>REPORT</method>
<ruri>$addressbookhome2:/</ruri>
@@ -1686,7 +2102,7 @@
</grabelement>
</request>
</test>
- <test name='13f' ignore='no'>
+ <test name='19f' ignore='no'>
<request user="$userid2:" pswd="$pswd2:" print-response='no'>
<method>REPORT</method>
<ruri>$addressbookhome2:/</ruri>
@@ -1707,7 +2123,7 @@
</grabelement>
</request>
</test>
- <test name='13g' ignore='no'>
+ <test name='19g' ignore='no'>
<request user="$userid2:" pswd="$pswd2:" print-response='no'>
<method>REPORT</method>
<ruri>$addressbookhome2:/$userguid1:/</ruri>
@@ -1726,7 +2142,9 @@
</test>
</test-suite>
- <!-- test suites below are similar to those in ../CalDAV/sync-report.xml but use shared address books of calendars in the home -->
+ <!-- test suites below are similar to those in ../CalDAV/sync-report.xml but
+ use shared address books instead of calendars -->
+
<test-suite name='support-report-set/sync-token property' ignore='no'>
<test name='0' ignore='no'>
<description>clean up old data</description>
Modified: CalendarServer/branches/users/gaya/sharedgroupfixes/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroupfixes/txdav/carddav/datastore/sql.py 2013-09-30 23:43:46 UTC (rev 11766)
+++ CalendarServer/branches/users/gaya/sharedgroupfixes/txdav/carddav/datastore/sql.py 2013-09-30 23:51:10 UTC (rev 11767)
@@ -584,7 +584,6 @@
@param depth: depth for determine what changed
@type depth: C{str}
"""
-
assert not self.owned()
bindRevisions = [self._bindRevision] if self.fullyShared() else []
@@ -629,8 +628,8 @@
) if name
]
- # id's are added on deletion
- idToNameMap = dict([(id, name) for name, id, wasdeleted in results if id != 0])
+ # get deleted object names if any
+ idToNameMap = dict([(id, name) for name, id, wasdeleted in results if wasdeleted])
# now get other names of existing objects
missingNameIds = (allowedObjectIDs | oldAllowedObjectIDs) - set(idToNameMap.keys())
@@ -644,30 +643,35 @@
)
idToNameMap = dict(dict(idToNameMap), **dict(memberIDNameRows))
- # for changes, get object names all at once here
+ # now do revisions
if revision:
- if depth == "1":
- if removedObjectIds:
- changed.add("%s/" % (path,))
- else:
+ if removedObjectIds or addedObjectIds:
+ changed.add("%s/" % (path,))
+
+ if depth != "1":
for removedObjectId in removedObjectIds:
deleted.add("%s/%s" % (path, idToNameMap[removedObjectId],))
- if depth != "1":
for addedObjectId in addedObjectIds:
changed.add("%s/%s" % (path, idToNameMap[addedObjectId],))
- for name, id, wasdeleted in results:
- if name in idToNameMap.values():
- # Always report collection as changed
- changed.add("%s/" % (path,))
+ for name, id, wasdeleted in results:
+ if not wasdeleted and name in idToNameMap.values():
+ # Always report collection as changed
+ changed.add("%s/" % (path,))
- # Resource changed - for depth "infinity" report resource as changed
- if depth != "1":
- item = "%s/%s" % (path, name,)
- if item not in deleted:
- changed.add("%s/%s" % (path, name,))
+ # Resource changed - for depth "infinity" report resource as changed
+ if depth != "1":
+ item = "%s/%s" % (path, name,)
+ if item not in deleted:
+ changed.add("%s/%s" % (path, name,))
+ else:
+ changed.add("%s/" % (path,))
+ if depth != "1":
+ for addedObjectId in allowedObjectIDs:
+ changed.add("%s/%s" % (path, idToNameMap[addedObjectId],))
+
returnValue((changed, deleted))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130930/2cd41f3d/attachment-0001.html>
More information about the calendarserver-changes
mailing list