[CalendarServer-changes] [3476] CalDAVTester/trunk

source_changes at macosforge.org source_changes at macosforge.org
Mon Dec 8 10:55:26 PST 2008


Revision: 3476
          http://trac.macosforge.org/projects/calendarserver/changeset/3476
Author:   cdaboo at apple.com
Date:     2008-12-08 10:55:25 -0800 (Mon, 08 Dec 2008)
Log Message:
-----------
Test for client limits for the principal-property-search report and 507 response.

Modified Paths:
--------------
    CalDAVTester/trunk/scripts/tests/aclreports.xml
    CalDAVTester/trunk/verifiers/multistatusItems.py

Added Paths:
-----------
    CalDAVTester/trunk/Resource/aclreports/25.xml
    CalDAVTester/trunk/Resource/aclreports/26.xml
    CalDAVTester/trunk/Resource/aclreports/27.xml
    CalDAVTester/trunk/Resource/aclreports/28.xml
    CalDAVTester/trunk/Resource/aclreports/29.xml
    CalDAVTester/trunk/Resource/aclreports/30.xml
    CalDAVTester/trunk/Resource/aclreports/31.xml
    CalDAVTester/trunk/Resource/aclreports/32.xml

Added: CalDAVTester/trunk/Resource/aclreports/25.xml
===================================================================
--- CalDAVTester/trunk/Resource/aclreports/25.xml	                        (rev 0)
+++ CalDAVTester/trunk/Resource/aclreports/25.xml	2008-12-08 18:55:25 UTC (rev 3476)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<D:principal-property-search xmlns:D="DAV:" xmlns:c="http://calendarserver.org/ns/" test="anyof" type="INDIVIDUAL">
+ <D:apply-to-principal-collection-set/>
+ <D:property-search>
+   <D:prop>
+     <c:first-name/>
+   </D:prop>
+   <D:match match-type="starts-with">appren</D:match>
+ </D:property-search>
+ <D:property-search>
+   <D:prop>
+     <c:last-name/>
+   </D:prop>
+   <D:match match-type="contains">user</D:match>
+ </D:property-search>
+ <D:prop>
+   <D:displayname/>
+   <c:first-name/>
+   <c:last-name/>
+   <c:email-address-set/>
+ </D:prop>
+ <c:limit><c:nresults>1</c:nresults></c:limit>
+</D:principal-property-search>

Added: CalDAVTester/trunk/Resource/aclreports/26.xml
===================================================================
--- CalDAVTester/trunk/Resource/aclreports/26.xml	                        (rev 0)
+++ CalDAVTester/trunk/Resource/aclreports/26.xml	2008-12-08 18:55:25 UTC (rev 3476)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<D:principal-property-search xmlns:D="DAV:" xmlns:c="http://calendarserver.org/ns/" test="anyof" type="INDIVIDUAL">
+ <D:apply-to-principal-collection-set/>
+ <D:property-search>
+   <D:prop>
+     <c:first-name/>
+   </D:prop>
+   <D:match match-type="starts-with">appren</D:match>
+ </D:property-search>
+ <D:property-search>
+   <D:prop>
+     <c:last-name/>
+   </D:prop>
+   <D:match match-type="contains">user</D:match>
+ </D:property-search>
+ <D:prop>
+   <D:displayname/>
+   <c:first-name/>
+   <c:last-name/>
+   <c:email-address-set/>
+ </D:prop>
+ <c:limit><c:nresults>abc</c:nresults></c:limit>
+</D:principal-property-search>

Added: CalDAVTester/trunk/Resource/aclreports/27.xml
===================================================================
--- CalDAVTester/trunk/Resource/aclreports/27.xml	                        (rev 0)
+++ CalDAVTester/trunk/Resource/aclreports/27.xml	2008-12-08 18:55:25 UTC (rev 3476)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<D:principal-property-search xmlns:D="DAV:" xmlns:c="http://calendarserver.org/ns/" test="anyof" type="INDIVIDUAL">
+ <D:apply-to-principal-collection-set/>
+ <D:property-search>
+   <D:prop>
+     <c:first-name/>
+   </D:prop>
+   <D:match match-type="starts-with">appren</D:match>
+ </D:property-search>
+ <D:property-search>
+   <D:prop>
+     <c:last-name/>
+   </D:prop>
+   <D:match match-type="contains">user</D:match>
+ </D:property-search>
+ <D:prop>
+   <D:displayname/>
+   <c:first-name/>
+   <c:last-name/>
+   <c:email-address-set/>
+ </D:prop>
+ <c:limit/>
+</D:principal-property-search>

Added: CalDAVTester/trunk/Resource/aclreports/28.xml
===================================================================
--- CalDAVTester/trunk/Resource/aclreports/28.xml	                        (rev 0)
+++ CalDAVTester/trunk/Resource/aclreports/28.xml	2008-12-08 18:55:25 UTC (rev 3476)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<D:principal-property-search xmlns:D="DAV:" xmlns:c="http://calendarserver.org/ns/" test="bogus" type="INDIVIDUAL">
+ <D:apply-to-principal-collection-set/>
+ <D:property-search>
+   <D:prop>
+     <c:first-name/>
+   </D:prop>
+   <D:match match-type="starts-with">appren</D:match>
+ </D:property-search>
+ <D:property-search>
+   <D:prop>
+     <c:last-name/>
+   </D:prop>
+   <D:match match-type="contains">user</D:match>
+ </D:property-search>
+ <D:prop>
+   <D:displayname/>
+   <c:first-name/>
+   <c:last-name/>
+   <c:email-address-set/>
+ </D:prop>
+ <c:limit><c:nresults>1</c:nresults></c:limit>
+</D:principal-property-search>

Added: CalDAVTester/trunk/Resource/aclreports/29.xml
===================================================================
--- CalDAVTester/trunk/Resource/aclreports/29.xml	                        (rev 0)
+++ CalDAVTester/trunk/Resource/aclreports/29.xml	2008-12-08 18:55:25 UTC (rev 3476)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<D:principal-property-search xmlns:D="DAV:" xmlns:c="http://calendarserver.org/ns/" test="anyof" type="bogus">
+ <D:apply-to-principal-collection-set/>
+ <D:property-search>
+   <D:prop>
+     <c:first-name/>
+   </D:prop>
+   <D:match match-type="starts-with">appren</D:match>
+ </D:property-search>
+ <D:property-search>
+   <D:prop>
+     <c:last-name/>
+   </D:prop>
+   <D:match match-type="contains">user</D:match>
+ </D:property-search>
+ <D:prop>
+   <D:displayname/>
+   <c:first-name/>
+   <c:last-name/>
+   <c:email-address-set/>
+ </D:prop>
+ <c:limit><c:nresults>1</c:nresults></c:limit>
+</D:principal-property-search>

Added: CalDAVTester/trunk/Resource/aclreports/30.xml
===================================================================
--- CalDAVTester/trunk/Resource/aclreports/30.xml	                        (rev 0)
+++ CalDAVTester/trunk/Resource/aclreports/30.xml	2008-12-08 18:55:25 UTC (rev 3476)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<D:principal-property-search xmlns:D="DAV:" xmlns:c="http://calendarserver.org/ns/" test="anyof" type="INDIVIDUAL">
+ <D:apply-to-principal-collection-set/>
+ <D:property-search>
+   <D:prop>
+     <c:first-name/>
+   </D:prop>
+   <D:match caseless="bogus" match-type="starts-with">appren</D:match>
+ </D:property-search>
+ <D:property-search>
+   <D:prop>
+     <c:last-name/>
+   </D:prop>
+   <D:match match-type="contains">user</D:match>
+ </D:property-search>
+ <D:prop>
+   <D:displayname/>
+   <c:first-name/>
+   <c:last-name/>
+   <c:email-address-set/>
+ </D:prop>
+ <c:limit><c:nresults>1</c:nresults></c:limit>
+</D:principal-property-search>

Added: CalDAVTester/trunk/Resource/aclreports/31.xml
===================================================================
--- CalDAVTester/trunk/Resource/aclreports/31.xml	                        (rev 0)
+++ CalDAVTester/trunk/Resource/aclreports/31.xml	2008-12-08 18:55:25 UTC (rev 3476)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<D:principal-property-search xmlns:D="DAV:" xmlns:c="http://calendarserver.org/ns/" test="anyof" type="INDIVIDUAL">
+ <D:apply-to-principal-collection-set/>
+ <D:property-search>
+   <D:prop>
+     <c:first-name/>
+   </D:prop>
+   <D:match match-type="bogus">appren</D:match>
+ </D:property-search>
+ <D:property-search>
+   <D:prop>
+     <c:last-name/>
+   </D:prop>
+   <D:match match-type="contains">user</D:match>
+ </D:property-search>
+ <D:prop>
+   <D:displayname/>
+   <c:first-name/>
+   <c:last-name/>
+   <c:email-address-set/>
+ </D:prop>
+ <c:limit><c:nresults>1</c:nresults></c:limit>
+</D:principal-property-search>

Added: CalDAVTester/trunk/Resource/aclreports/32.xml
===================================================================
--- CalDAVTester/trunk/Resource/aclreports/32.xml	                        (rev 0)
+++ CalDAVTester/trunk/Resource/aclreports/32.xml	2008-12-08 18:55:25 UTC (rev 3476)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<D:principal-property-search xmlns:D="DAV:" xmlns:c="http://calendarserver.org/ns/" test="anyof" type="INDIVIDUAL">
+ <D:apply-to-principal-collection-set/>
+ <D:property-search>
+   <D:prop>
+     <c:first-name/>
+   </D:prop>
+   <D:match match-type="starts-with">Use</D:match>
+ </D:property-search>
+ <D:prop>
+   <D:displayname/>
+   <c:first-name/>
+   <c:last-name/>
+   <c:email-address-set/>
+ </D:prop>
+ <c:limit><c:nresults>5</c:nresults></c:limit>
+</D:principal-property-search>

Modified: CalDAVTester/trunk/scripts/tests/aclreports.xml
===================================================================
--- CalDAVTester/trunk/scripts/tests/aclreports.xml	2008-12-08 18:54:31 UTC (rev 3475)
+++ CalDAVTester/trunk/scripts/tests/aclreports.xml	2008-12-08 18:55:25 UTC (rev 3476)
@@ -584,6 +584,184 @@
 				</verify>
 			</request>
 		</test>
+		<test name='11' ignore='no'>
+			<description>Valid INDIVIDUAL first-name OR last-name search report - limit 1</description>
+			<request print-response='no' user='$useradmin:' pswd='$pswdadmin:'>
+				<method>REPORT</method>
+				<ruri>1.ics</ruri>
+				<data>
+					<content-type>text/xml; charset=utf-8</content-type>
+					<filepath>Resource/aclreports/25.xml</filepath>
+				</data>
+				<verify>
+					<callback>multistatusItems</callback>
+					<arg>
+						<name>prefix</name>
+						<value/>
+					</arg>
+					<arg>
+						<name>okhrefs</name>
+						<value>$uids:admin/</value>
+					</arg>
+					<arg>
+						<name>badhrefs</name>
+						<value>$calendarpath1:/1.ics</value>
+					</arg>
+				</verify>
+				<verify>
+					<callback>dataString</callback>
+					<arg>
+						<name>contains</name>
+						<value>507</value>
+					</arg>
+				</verify>
+			</request>
+		</test>
+		<test name='12' ignore='no'>
+			<description>Invalid INDIVIDUAL first-name OR last-name search report - limit bogus</description>
+			<request print-response='no' user='$useradmin:' pswd='$pswdadmin:'>
+				<method>REPORT</method>
+				<ruri>1.ics</ruri>
+				<data>
+					<content-type>text/xml; charset=utf-8</content-type>
+					<filepath>Resource/aclreports/26.xml</filepath>
+				</data>
+				<verify>
+					<callback>statusCode</callback>
+					<arg>
+						<name>status</name>
+						<value>400</value>
+					</arg>
+				</verify>
+			</request>
+		</test>
+		<test name='13' ignore='no'>
+			<description>Invalid INDIVIDUAL first-name OR last-name search report - limit bogus</description>
+			<request print-response='no' user='$useradmin:' pswd='$pswdadmin:'>
+				<method>REPORT</method>
+				<ruri>1.ics</ruri>
+				<data>
+					<content-type>text/xml; charset=utf-8</content-type>
+					<filepath>Resource/aclreports/27.xml</filepath>
+				</data>
+				<verify>
+					<callback>statusCode</callback>
+					<arg>
+						<name>status</name>
+						<value>400</value>
+					</arg>
+				</verify>
+			</request>
+		</test>
+		<test name='14' ignore='no'>
+			<description>Invalid search report - test attribute bogus</description>
+			<request print-response='no' user='$useradmin:' pswd='$pswdadmin:'>
+				<method>REPORT</method>
+				<ruri>1.ics</ruri>
+				<data>
+					<content-type>text/xml; charset=utf-8</content-type>
+					<filepath>Resource/aclreports/28.xml</filepath>
+				</data>
+				<verify>
+					<callback>statusCode</callback>
+					<arg>
+						<name>status</name>
+						<value>400</value>
+					</arg>
+				</verify>
+			</request>
+		</test>
+		<test name='15' ignore='no'>
+			<description>Invalid search report - type attribute bogus</description>
+			<request print-response='no' user='$useradmin:' pswd='$pswdadmin:'>
+				<method>REPORT</method>
+				<ruri>1.ics</ruri>
+				<data>
+					<content-type>text/xml; charset=utf-8</content-type>
+					<filepath>Resource/aclreports/29.xml</filepath>
+				</data>
+				<verify>
+					<callback>statusCode</callback>
+					<arg>
+						<name>status</name>
+						<value>400</value>
+					</arg>
+				</verify>
+			</request>
+		</test>
+		<test name='16' ignore='no'>
+			<description>Invalid search report - caseless attribute bogus</description>
+			<request print-response='no' user='$useradmin:' pswd='$pswdadmin:'>
+				<method>REPORT</method>
+				<ruri>1.ics</ruri>
+				<data>
+					<content-type>text/xml; charset=utf-8</content-type>
+					<filepath>Resource/aclreports/30.xml</filepath>
+				</data>
+				<verify>
+					<callback>statusCode</callback>
+					<arg>
+						<name>status</name>
+						<value>400</value>
+					</arg>
+				</verify>
+			</request>
+		</test>
+		<test name='17' ignore='no'>
+			<description>Invalid search report - match-type attribute bogus</description>
+			<request print-response='no' user='$useradmin:' pswd='$pswdadmin:'>
+				<method>REPORT</method>
+				<ruri>1.ics</ruri>
+				<data>
+					<content-type>text/xml; charset=utf-8</content-type>
+					<filepath>Resource/aclreports/31.xml</filepath>
+				</data>
+				<verify>
+					<callback>statusCode</callback>
+					<arg>
+						<name>status</name>
+						<value>400</value>
+					</arg>
+				</verify>
+			</request>
+		</test>
+		<test name='18' ignore='no'>
+			<description>Valid INDIVIDUAL first-name search report - limit 5</description>
+			<request print-response='no' user='$useradmin:' pswd='$pswdadmin:'>
+				<method>REPORT</method>
+				<ruri>1.ics</ruri>
+				<data>
+					<content-type>text/xml; charset=utf-8</content-type>
+					<filepath>Resource/aclreports/32.xml</filepath>
+				</data>
+				<verify>
+					<callback>multistatusItems</callback>
+					<arg>
+						<name>prefix</name>
+						<value/>
+					</arg>
+					<arg>
+						<name>okhrefs</name>
+						<value>$uids:user01/</value>
+						<value>$uids:user02/</value>
+						<value>$uids:user03/</value>
+						<value>$uids:user04/</value>
+						<value>$uids:user05/</value>
+					</arg>
+					<arg>
+						<name>badhrefs</name>
+						<value>$calendarpath1:/1.ics</value>
+					</arg>
+				</verify>
+				<verify>
+					<callback>dataString</callback>
+					<arg>
+						<name>contains</name>
+						<value>507</value>
+					</arg>
+				</verify>
+			</request>
+		</test>
 	</test-suite>
 	
 	<test-suite name='principal-search-property-set REPORT' ignore='no'>

Modified: CalDAVTester/trunk/verifiers/multistatusItems.py
===================================================================
--- CalDAVTester/trunk/verifiers/multistatusItems.py	2008-12-08 18:54:31 UTC (rev 3475)
+++ CalDAVTester/trunk/verifiers/multistatusItems.py	2008-12-08 18:55:25 UTC (rev 3476)
@@ -56,8 +56,8 @@
 
             # Get href for this response
             href = ElementsByName(response, "DAV:", "href")
-            if len(href) != 1:
-                return
+            if href is None or len(href) != 1:
+                return False, "        Incorrect/missing DAV:Href element in response"
             if href[0].firstChild is not None:
                 href = href[0].firstChild.data
             else:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081208/3a57bea4/attachment-0001.html>


More information about the calendarserver-changes mailing list