[CalendarServer-changes] [11771] CalDAVTester/trunk

source_changes at macosforge.org source_changes at macosforge.org
Tue Oct 1 09:05:19 PDT 2013


Revision: 11771
          http://trac.calendarserver.org//changeset/11771
Author:   cdaboo at apple.com
Date:     2013-10-01 09:05:19 -0700 (Tue, 01 Oct 2013)
Log Message:
-----------
Tests for return=representation and 412 response.

Modified Paths:
--------------
    CalDAVTester/trunk/scripts/tests/CalDAV/prefer.xml
    CalDAVTester/trunk/verifiers/calendarDataMatch.py

Modified: CalDAVTester/trunk/scripts/tests/CalDAV/prefer.xml
===================================================================
--- CalDAVTester/trunk/scripts/tests/CalDAV/prefer.xml	2013-10-01 16:04:26 UTC (rev 11770)
+++ CalDAVTester/trunk/scripts/tests/CalDAV/prefer.xml	2013-10-01 16:05:19 UTC (rev 11771)
@@ -637,6 +637,43 @@
 				</verify>
 			</request>
 		</test>
+		<test name='5'>
+			<description>PUT with Prefer=return=representation pre-condition fail</description>
+			<request>
+				<method>PUT</method>
+				<ruri>$calendarpath1:/4.ics</ruri>
+				<header>
+					<name>Prefer</name>
+					<value>return=representation</value>
+				</header>
+				<header>
+					<name>If-Match</name>
+					<value>1234</value>
+				</header>
+				<data>
+					<content-type>text/calendar; charset=utf-8</content-type>
+					<filepath>Resource/CalDAV/prefer/return/5.ics</filepath>
+				</data>
+				<verify>
+					<callback>calendarDataMatch</callback>
+					<arg>
+						<name>filepath</name>
+						<value>Resource/CalDAV/prefer/return/5.ics</value>
+					</arg>
+					<arg>
+						<name>status</name>
+						<value>412</value>
+					</arg>
+				</verify>
+				<verify>
+					<callback>header</callback>
+					<arg>
+						<name>content-location</name>
+						<value>$calendarpath1:/4.ics</value>
+					</arg>
+				</verify>
+			</request>
+		</test>
 	</test-suite>
 
 	<test-suite name='representation schedule PUT'>
@@ -769,6 +806,43 @@
 				</verify>
 			</request>
 		</test>
+		<test name='5'>
+			<description>PUT with Prefer=return=representation If-Schedule-Tag-Match failure</description>
+			<request>
+				<method>PUT</method>
+				<ruri>$calendarpath1:/7.ics</ruri>
+				<header>
+					<name>Prefer</name>
+					<value>return=representation</value>
+				</header>
+				<header>
+					<name>If-Schedule-Tag-Match</name>
+					<value>1234</value>
+				</header>
+				<data>
+					<content-type>text/calendar; charset=utf-8</content-type>
+					<filepath>Resource/CalDAV/prefer/return/10.ics</filepath>
+				</data>
+				<verify>
+					<callback>calendarDataMatch</callback>
+					<arg>
+						<name>filepath</name>
+						<value>Resource/CalDAV/prefer/return/11.ics</value>
+					</arg>
+					<arg>
+						<name>status</name>
+						<value>412</value>
+					</arg>
+				</verify>
+				<verify>
+					<callback>header</callback>
+					<arg>
+						<name>content-location</name>
+						<value>$calendarpath1:/4.ics</value>
+					</arg>
+				</verify>
+			</request>
+		</test>
 	</test-suite>
 
 	<test-suite name='representation POST add-member'>

Modified: CalDAVTester/trunk/verifiers/calendarDataMatch.py
===================================================================
--- CalDAVTester/trunk/verifiers/calendarDataMatch.py	2013-10-01 16:04:26 UTC (rev 11770)
+++ CalDAVTester/trunk/verifiers/calendarDataMatch.py	2013-10-01 16:05:19 UTC (rev 11771)
@@ -29,6 +29,7 @@
         files = args.get("filepath", [])
         caldata = args.get("data", [])
         filters = args.get("filter", [])
+        statusCode = args.get("status", ["200", "201", "207"])
 
         if "EMAIL parameter" not in manager.server_info.features:
             filters.append("ATTENDEE:EMAIL")
@@ -46,8 +47,8 @@
                 filters.remove(afilter[1:])
         filters = filter(lambda x: x[0] != "!", filters)
 
-        # status code must be 200, 201, 207
-        if response.status not in (200, 201, 207):
+        # status code must be 200, 201, 207 or explicitly specified code
+        if str(response.status) not in statusCode:
             return False, "        HTTP Status Code Wrong: %d" % (response.status,)
 
         # look for response data
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20131001/fce93399/attachment.html>


More information about the calendarserver-changes mailing list