[CalendarServer-changes] [10875] CalDAVTester/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Mar 8 13:09:39 PST 2013
Revision: 10875
http://trac.calendarserver.org//changeset/10875
Author: cdaboo at apple.com
Date: 2013-03-08 13:09:39 -0800 (Fri, 08 Mar 2013)
Log Message:
-----------
Better handling of % encoding.
Modified Paths:
--------------
CalDAVTester/trunk/scripts/tests/CalDAV/encodedURIs.xml
CalDAVTester/trunk/scripts/tests/CalDAV/implicitproxy.xml
CalDAVTester/trunk/src/caldavtest.py
CalDAVTester/trunk/verifiers/aclItems.py
CalDAVTester/trunk/verifiers/multistatusItems.py
CalDAVTester/trunk/verifiers/propfindItems.py
CalDAVTester/trunk/verifiers/propfindValues.py
Modified: CalDAVTester/trunk/scripts/tests/CalDAV/encodedURIs.xml
===================================================================
--- CalDAVTester/trunk/scripts/tests/CalDAV/encodedURIs.xml 2013-03-08 19:47:48 UTC (rev 10874)
+++ CalDAVTester/trunk/scripts/tests/CalDAV/encodedURIs.xml 2013-03-08 21:09:39 UTC (rev 10875)
@@ -26,11 +26,11 @@
<start>
<request end-delete='yes'>
<method>MKCALENDAR</method>
- <ruri>$calendarhome1:/calendar%202/</ruri>
+ <ruri>$calendarhome1:/calendar 2/</ruri>
</request>
<request end-delete='yes'>
<method>MKCALENDAR</method>
- <ruri>$calendarhome1:/calendar%203/</ruri>
+ <ruri>$calendarhome1:/calendar 3/</ruri>
</request>
</start>
@@ -42,11 +42,11 @@
<description>PUT</description>
<request end-delete='yes'>
<method>MKCOL</method>
- <ruri>$calendarhome1:/collection%201/</ruri>
+ <ruri>$calendarhome1:/collection 1/</ruri>
</request>
<request print-response='no' end-delete='yes'>
<method>PUT</method>
- <ruri>$calendarhome1:/collection%201/2%20a.ics</ruri>
+ <ruri>$calendarhome1:/collection 1/2 a.ics</ruri>
<data>
<content-type>text/calendar; charset=utf-8</content-type>
<filepath>Resource/CalDAV/recurrenceput/2.txt</filepath>
@@ -71,10 +71,10 @@
<description>COPY</description>
<request print-response='no' end-delete='yes'>
<method>COPY</method>
- <ruri>$calendarhome1:/collection%201/2%20a.ics</ruri>
+ <ruri>$calendarhome1:/collection 1/2 a.ics</ruri>
<header>
<name>Destination</name>
- <value>$host:$calendarhome1:/collection%201/2_2%20a.ics</value>
+ <value>$host:$calendarhome1:/collection 1/2_2 a.ics</value>
</header>
<verify>
<callback>statusCode</callback>
@@ -83,13 +83,13 @@
<callback>header</callback>
<arg>
<name>header</name>
- <value>Location$$host:$calendarhome1:/collection%201/2_2%20a.ics</value>
+ <value>Location$$host:$calendarhome1:/collection 1/2_2 a.ics</value>
</arg>
</verify>
</request>
<request print-response='no'>
<method>PROPFIND</method>
- <ruri>$calendarhome1:/collection%201/2_2%20a.ics</ruri>
+ <ruri>$calendarhome1:/collection 1/2_2 a.ics</ruri>
<header>
<name>Depth</name>
<value>0</value>
@@ -109,7 +109,7 @@
</arg>
<arg>
<name>okhrefs</name>
- <value>$calendarhome1:/collection%201/2_2%20a.ics</value>
+ <value>$calendarhome1:/collection 1/2_2 a.ics</value>
</arg>
</verify>
</request>
@@ -121,10 +121,10 @@
<description>MOVE</description>
<request print-response='no' end-delete='yes'>
<method>MOVE</method>
- <ruri>$calendarhome1:/collection%201/2%20a.ics</ruri>
+ <ruri>$calendarhome1:/collection 1/2 a.ics</ruri>
<header>
<name>Destination</name>
- <value>$host:$calendarhome1:/collection%201/2_3%20a.ics</value>
+ <value>$host:$calendarhome1:/collection 1/2_3 a.ics</value>
</header>
<verify>
<callback>statusCode</callback>
@@ -133,13 +133,13 @@
<callback>header</callback>
<arg>
<name>header</name>
- <value>Location$$host:$calendarhome1:/collection%201/2_3%20a.ics</value>
+ <value>Location$$host:$calendarhome1:/collection 1/2_3 a.ics</value>
</arg>
</verify>
</request>
<request print-response='no'>
<method>PROPFIND</method>
- <ruri>$calendarhome1:/collection%201/2_2%20a.ics</ruri>
+ <ruri>$calendarhome1:/collection 1/2_2 a.ics</ruri>
<header>
<name>Depth</name>
<value>0</value>
@@ -159,7 +159,7 @@
</arg>
<arg>
<name>okhrefs</name>
- <value>$calendarhome1:/collection%201/2_2%20a.ics</value>
+ <value>$calendarhome1:/collection 1/2_2 a.ics</value>
</arg>
</verify>
</request>
@@ -171,7 +171,7 @@
<description>PUT</description>
<request print-response='no' end-delete='yes'>
<method>PUT</method>
- <ruri>$calendarpath1:/2%20a.ics</ruri>
+ <ruri>$calendarpath1:/2 a.ics</ruri>
<data>
<content-type>text/calendar; charset=utf-8</content-type>
<filepath>Resource/CalDAV/recurrenceput/2.txt</filepath>
@@ -209,7 +209,7 @@
<arg>
<name>okhrefs</name>
<value></value>
- <value>2%20a.ics</value>
+ <value>2 a.ics</value>
</arg>
</verify>
</request>
@@ -230,7 +230,7 @@
<callback>multistatusItems</callback>
<arg>
<name>okhrefs</name>
- <value>2%20a.ics</value>
+ <value>2 a.ics</value>
</arg>
</verify>
</request>
@@ -245,10 +245,10 @@
<description>COPY</description>
<request print-response='no' end-delete='yes'>
<method>COPY</method>
- <ruri>$calendarpath1:/2%20a.ics</ruri>
+ <ruri>$calendarpath1:/2 a.ics</ruri>
<header>
<name>Destination</name>
- <value>$host:$calendarhome1:/calendar%202/2_2%20a.ics</value>
+ <value>$host:$calendarhome1:/calendar 2/2_2 a.ics</value>
</header>
<verify>
<callback>statusCode</callback>
@@ -257,13 +257,13 @@
<callback>header</callback>
<arg>
<name>header</name>
- <value>Location$$host:$calendarhome1:/calendar%202/2_2%20a.ics</value>
+ <value>Location$$host:$calendarhome1:/calendar 2/2_2 a.ics</value>
</arg>
</verify>
</request>
<request print-response='no'>
<method>PROPFIND</method>
- <ruri>$calendarhome1:/calendar%202/2_2%20a.ics</ruri>
+ <ruri>$calendarhome1:/calendar 2/2_2 a.ics</ruri>
<header>
<name>Depth</name>
<value>0</value>
@@ -283,7 +283,7 @@
</arg>
<arg>
<name>okhrefs</name>
- <value>$calendarhome1:/calendar%202/2_2%20a.ics</value>
+ <value>$calendarhome1:/calendar 2/2_2 a.ics</value>
</arg>
</verify>
</request>
@@ -295,10 +295,10 @@
<description>MOVE</description>
<request print-response='no' end-delete='yes'>
<method>MOVE</method>
- <ruri>$calendarpath1:/2%20a.ics</ruri>
+ <ruri>$calendarpath1:/2 a.ics</ruri>
<header>
<name>Destination</name>
- <value>$host:$calendarhome1:/calendar%203/2_3%20a.ics</value>
+ <value>$host:$calendarhome1:/calendar 3/2_3 a.ics</value>
</header>
<verify>
<callback>statusCode</callback>
@@ -307,13 +307,13 @@
<callback>header</callback>
<arg>
<name>header</name>
- <value>Location$$host:$calendarhome1:/calendar%203/2_3%20a.ics</value>
+ <value>Location$$host:$calendarhome1:/calendar 3/2_3 a.ics</value>
</arg>
</verify>
</request>
<request print-response='no'>
<method>PROPFIND</method>
- <ruri>$calendarhome1:/calendar%203/2_3%20a.ics</ruri>
+ <ruri>$calendarhome1:/calendar 3/2_3 a.ics</ruri>
<header>
<name>Depth</name>
<value>0</value>
@@ -333,7 +333,7 @@
</arg>
<arg>
<name>okhrefs</name>
- <value>$calendarhome1:/calendar%203/2_3%20a.ics</value>
+ <value>$calendarhome1:/calendar 3/2_3 a.ics</value>
</arg>
</verify>
</request>
@@ -345,7 +345,7 @@
<description>multiget REPORT on encoded calendar collection path</description>
<request print-response='no'>
<method>REPORT</method>
- <ruri>$calendarhome1:/calendar%203/</ruri>
+ <ruri>$calendarhome1:/calendar 3/</ruri>
<data>
<content-type>text/xml; charset=utf-8</content-type>
<filepath>Resource/CalDAV/reports/multiget/encoded2.xml</filepath>
@@ -357,7 +357,7 @@
<callback>multistatusItems</callback>
<arg>
<name>okhrefs</name>
- <value>2_3%20a.ics</value>
+ <value>2_3 a.ics</value>
</arg>
</verify>
</request>
@@ -369,7 +369,7 @@
<description>multiget REPORT on encoded calendar resource path</description>
<request print-response='no'>
<method>REPORT</method>
- <ruri>$calendarhome1:/calendar%203/2_3%20a.ics</ruri>
+ <ruri>$calendarhome1:/calendar 3/2_3 a.ics</ruri>
<data>
<content-type>text/xml; charset=utf-8</content-type>
<filepath>Resource/CalDAV/reports/multiget/encoded2.xml</filepath>
@@ -405,7 +405,7 @@
<callback>multistatusItems</callback>
<arg>
<name>okhrefs</name>
- <value>calendar%203/2_3%20a.ics</value>
+ <value>calendar 3/2_3 a.ics</value>
</arg>
</verify>
</request>
@@ -417,7 +417,7 @@
<description>query REPORT on encoded calendar path</description>
<request print-response='no'>
<method>REPORT</method>
- <ruri>$calendarhome1:/calendar%203/</ruri>
+ <ruri>$calendarhome1:/calendar 3/</ruri>
<data>
<content-type>text/xml; charset=utf-8</content-type>
<filepath>Resource/CalDAV/reports/basicquery/1.txt</filepath>
@@ -429,7 +429,7 @@
<callback>multistatusItems</callback>
<arg>
<name>okhrefs</name>
- <value>2_3%20a.ics</value>
+ <value>2_3 a.ics</value>
</arg>
</verify>
</request>
@@ -441,7 +441,7 @@
<description>free-busy REPORT on encoded calendar path</description>
<request print-response='no'>
<method>REPORT</method>
- <ruri>$calendarhome1:/calendar%203/</ruri>
+ <ruri>$calendarhome1:/calendar 3/</ruri>
<data>
<content-type>text/xml; charset=utf-8</content-type>
<filepath>Resource/CalDAV/reports/freebusy/1.txt</filepath>
@@ -458,7 +458,7 @@
<description>PUT</description>
<request print-response='no' end-delete='yes'>
<method>PUT</method>
- <ruri>$calendarpath1:/3%2520a.ics</ruri>
+ <ruri>$calendarpath1:/3%20a.ics</ruri>
<data>
<content-type>text/calendar; charset=utf-8</content-type>
<filepath>Resource/CalDAV/recurrenceput/3.txt</filepath>
@@ -496,7 +496,7 @@
<arg>
<name>okhrefs</name>
<value></value>
- <value>3%2520a.ics</value>
+ <value>3%20a.ics</value>
</arg>
</verify>
</request>
@@ -517,7 +517,7 @@
<callback>multistatusItems</callback>
<arg>
<name>okhrefs</name>
- <value>3%2520a.ics</value>
+ <value>3%20a.ics</value>
</arg>
</verify>
</request>
@@ -532,10 +532,10 @@
<description>COPY</description>
<request print-response='no' end-delete='yes'>
<method>COPY</method>
- <ruri>$calendarpath1:/3%2520a.ics</ruri>
+ <ruri>$calendarpath1:/3%20a.ics</ruri>
<header>
<name>Destination</name>
- <value>$host:$calendarhome1:/calendar%202/3_2%2520a.ics</value>
+ <value>$host:$calendarhome1:/calendar 2/3_2%2520a.ics</value>
</header>
<verify>
<callback>statusCode</callback>
@@ -544,13 +544,13 @@
<callback>header</callback>
<arg>
<name>header</name>
- <value>Location$$host:$calendarhome1:/calendar%202/3_2%2520a.ics</value>
+ <value>Location$$host:$calendarhome1:/calendar 2/3_2%2520a.ics</value>
</arg>
</verify>
</request>
<request print-response='no'>
<method>PROPFIND</method>
- <ruri>$calendarhome1:/calendar%202/3_2%2520a.ics</ruri>
+ <ruri>$calendarhome1:/calendar 2/3_2%20a.ics</ruri>
<header>
<name>Depth</name>
<value>0</value>
@@ -570,7 +570,7 @@
</arg>
<arg>
<name>okhrefs</name>
- <value>$calendarhome1:/calendar%202/3_2%2520a.ics</value>
+ <value>$calendarhome1:/calendar 2/3_2%20a.ics</value>
</arg>
</verify>
</request>
@@ -582,10 +582,10 @@
<description>MOVE</description>
<request print-response='no' end-delete='yes'>
<method>MOVE</method>
- <ruri>$calendarpath1:/3%2520a.ics</ruri>
+ <ruri>$calendarpath1:/3%20a.ics</ruri>
<header>
<name>Destination</name>
- <value>$host:$calendarhome1:/calendar%203/3_3%2520a.ics</value>
+ <value>$host:$calendarhome1:/calendar 3/3_3%2520a.ics</value>
</header>
<verify>
<callback>statusCode</callback>
@@ -594,13 +594,13 @@
<callback>header</callback>
<arg>
<name>header</name>
- <value>Location$$host:$calendarhome1:/calendar%203/3_3%2520a.ics</value>
+ <value>Location$$host:$calendarhome1:/calendar 3/3_3%2520a.ics</value>
</arg>
</verify>
</request>
<request print-response='no'>
<method>PROPFIND</method>
- <ruri>$calendarhome1:/calendar%203/3_3%2520a.ics</ruri>
+ <ruri>$calendarhome1:/calendar 3/3_3%20a.ics</ruri>
<header>
<name>Depth</name>
<value>0</value>
@@ -620,7 +620,7 @@
</arg>
<arg>
<name>okhrefs</name>
- <value>$calendarhome1:/calendar%203/3_3%2520a.ics</value>
+ <value>$calendarhome1:/calendar 3/3_3%20a.ics</value>
</arg>
</verify>
</request>
@@ -632,7 +632,7 @@
<description>multiget REPORT on encoded calendar collection path</description>
<request print-response='no'>
<method>REPORT</method>
- <ruri>$calendarhome1:/calendar%203/</ruri>
+ <ruri>$calendarhome1:/calendar 3/</ruri>
<data>
<content-type>text/xml; charset=utf-8</content-type>
<filepath>Resource/CalDAV/reports/multiget/doubleencoded2.xml</filepath>
@@ -644,7 +644,7 @@
<callback>multistatusItems</callback>
<arg>
<name>okhrefs</name>
- <value>3_3%2520a.ics</value>
+ <value>3_3%20a.ics</value>
</arg>
</verify>
</request>
@@ -656,7 +656,7 @@
<description>multiget REPORT on encoded calendar resource path</description>
<request print-response='no'>
<method>REPORT</method>
- <ruri>$calendarhome1:/calendar%203/3_3%2520a.ics</ruri>
+ <ruri>$calendarhome1:/calendar 3/3_3%20a.ics</ruri>
<data>
<content-type>text/xml; charset=utf-8</content-type>
<filepath>Resource/CalDAV/reports/multiget/doubleencoded2.xml</filepath>
@@ -692,7 +692,7 @@
<callback>multistatusItems</callback>
<arg>
<name>okhrefs</name>
- <value>calendar%203/3_3%2520a.ics</value>
+ <value>calendar 3/3_3%20a.ics</value>
</arg>
</verify>
</request>
@@ -704,7 +704,7 @@
<description>query REPORT on encoded calendar path</description>
<request print-response='no'>
<method>REPORT</method>
- <ruri>$calendarhome1:/calendar%203/</ruri>
+ <ruri>$calendarhome1:/calendar 3/</ruri>
<data>
<content-type>text/xml; charset=utf-8</content-type>
<filepath>Resource/CalDAV/reports/basicquery/1.txt</filepath>
@@ -716,8 +716,8 @@
<callback>multistatusItems</callback>
<arg>
<name>okhrefs</name>
- <value>2_3%20a.ics</value>
- <value>3_3%2520a.ics</value>
+ <value>2_3 a.ics</value>
+ <value>3_3%20a.ics</value>
</arg>
</verify>
</request>
@@ -729,7 +729,7 @@
<description>free-busy REPORT on encoded calendar path</description>
<request print-response='no'>
<method>REPORT</method>
- <ruri>$calendarhome1:/calendar%203/</ruri>
+ <ruri>$calendarhome1:/calendar 3/</ruri>
<data>
<content-type>text/xml; charset=utf-8</content-type>
<filepath>Resource/CalDAV/reports/freebusy/1.txt</filepath>
Modified: CalDAVTester/trunk/scripts/tests/CalDAV/implicitproxy.xml
===================================================================
--- CalDAVTester/trunk/scripts/tests/CalDAV/implicitproxy.xml 2013-03-08 19:47:48 UTC (rev 10874)
+++ CalDAVTester/trunk/scripts/tests/CalDAV/implicitproxy.xml 2013-03-08 21:09:39 UTC (rev 10875)
@@ -433,25 +433,16 @@
<request>
<method>DELETEALL</method>
<ruri>$inboxpath1:/</ruri>
- </request>
- <request>
- <method>DELETEALL</method>
<ruri>$calendarpath:/</ruri>
</request>
<request user="$userid2:" pswd="$pswd2:">
<method>DELETEALL</method>
<ruri>$inboxpath2:/</ruri>
- </request>
- <request user="$userid2:" pswd="$userid2:">
- <method>DELETEALL</method>
<ruri>$calendarpath2:/</ruri>
</request>
<request user="$userid3:" pswd="$pswd3:">
<method>DELETEALL</method>
<ruri>$inboxpath3:/</ruri>
- </request>
- <request user="$userid3:" pswd="$userid3:">
- <method>DELETEALL</method>
<ruri>$calendarpath3:/</ruri>
</request>
Modified: CalDAVTester/trunk/src/caldavtest.py
===================================================================
--- CalDAVTester/trunk/src/caldavtest.py 2013-03-08 19:47:48 UTC (rev 10874)
+++ CalDAVTester/trunk/src/caldavtest.py 2013-03-08 21:09:39 UTC (rev 10875)
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
##
+import urllib
+import urlparse
"""
Class to encapsulate a single caldav test run.
@@ -550,7 +552,11 @@
try:
#self.manager.log(manager.LOG_LOW, "Sending request")
- http.request(method, uri, data, headers)
+ puri = list(urlparse.urlparse(uri))
+ puri[2] = urllib.quote(puri[2])
+ quri = urlparse.urlunparse(puri)
+
+ http.request(method, quri, data, headers)
#self.manager.log(manager.LOG_LOW, "Sent request")
response = http.getresponse()
Modified: CalDAVTester/trunk/verifiers/aclItems.py
===================================================================
--- CalDAVTester/trunk/verifiers/aclItems.py 2013-03-08 19:47:48 UTC (rev 10874)
+++ CalDAVTester/trunk/verifiers/aclItems.py 2013-03-08 21:09:39 UTC (rev 10875)
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
##
+import urllib
"""
Verifier that checks a propfind response to make sure that the specified ACL privileges
@@ -49,7 +50,7 @@
href = response.findall("{DAV:}href")
if len(href) != 1:
return False, " Wrong number of DAV:href elements\n"
- href = href[0].text
+ href = urllib.unquote(href[0].text)
# Get all privileges
granted_privs = []
Modified: CalDAVTester/trunk/verifiers/multistatusItems.py
===================================================================
--- CalDAVTester/trunk/verifiers/multistatusItems.py 2013-03-08 19:47:48 UTC (rev 10874)
+++ CalDAVTester/trunk/verifiers/multistatusItems.py 2013-03-08 21:09:39 UTC (rev 10875)
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
##
+import urllib
"""
Verifier that checks a multistatus response to make sure that the specified hrefs
@@ -85,7 +86,7 @@
href = response.findall("{DAV:}href")
if href is None or len(href) != 1:
return False, " Incorrect/missing DAV:Href element in response"
- href = href[0].text
+ href = urllib.unquote(href[0].text)
# Verify status
status = response.findall("{DAV:}status")
Modified: CalDAVTester/trunk/verifiers/propfindItems.py
===================================================================
--- CalDAVTester/trunk/verifiers/propfindItems.py 2013-03-08 19:47:48 UTC (rev 10874)
+++ CalDAVTester/trunk/verifiers/propfindItems.py 2013-03-08 21:09:39 UTC (rev 10875)
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
##
+import urllib
"""
Verifier that checks a propfind response to make sure that the specified properties
@@ -128,7 +129,7 @@
href = response.find("{DAV:}href")
if href is None:
return False, " Wrong number of DAV:href elements\n"
- href = href.text
+ href = urllib.unquote(href.text)
if href in ignores:
continue
if only and href not in only:
Modified: CalDAVTester/trunk/verifiers/propfindValues.py
===================================================================
--- CalDAVTester/trunk/verifiers/propfindValues.py 2013-03-08 19:47:48 UTC (rev 10874)
+++ CalDAVTester/trunk/verifiers/propfindValues.py 2013-03-08 21:09:39 UTC (rev 10875)
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
##
+import urllib
"""
Verifier that checks a propfind response for regex matches to property values.
@@ -77,7 +78,7 @@
href = response.findall("{DAV:}href")
if len(href) != 1:
return False, " Wrong number of DAV:href elements\n"
- href = href[0].text
+ href = urllib.unquote(href[0].text)
if href in ignores:
continue
if only and href not in only:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130308/50e95ed9/attachment-0001.html>
More information about the calendarserver-changes
mailing list