<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[14196] CalDAVTester/trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/14196">14196</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2014-12-04 12:45:50 -0800 (Thu, 04 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add a --basedir option to allow running a set of tests for some completely different HTTP service. Enhance JSON pointer handling.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalDAVTestertrunkREADMEtxt">CalDAVTester/trunk/README.txt</a></li>
<li><a href="#CalDAVTestertrunkscriptstestsCalDAVcaldavtestdtd">CalDAVTester/trunk/scripts/tests/CalDAV/caldavtest.dtd</a></li>
<li><a href="#CalDAVTestertrunkscriptstestsCardDAVcaldavtestdtd">CalDAVTester/trunk/scripts/tests/CardDAV/caldavtest.dtd</a></li>
<li><a href="#CalDAVTestertrunkscriptstestspodCalDAVcaldavtestdtd">CalDAVTester/trunk/scripts/tests-pod/CalDAV/caldavtest.dtd</a></li>
<li><a href="#CalDAVTestertrunksrccaldavtestpy">CalDAVTester/trunk/src/caldavtest.py</a></li>
<li><a href="#CalDAVTestertrunksrcmanagerpy">CalDAVTester/trunk/src/manager.py</a></li>
<li><a href="#CalDAVTestertrunksrcrequestpy">CalDAVTester/trunk/src/request.py</a></li>
<li><a href="#CalDAVTestertrunksrcserverinfopy">CalDAVTester/trunk/src/serverinfo.py</a></li>
<li><a href="#CalDAVTestertrunksrcxmlDefspy">CalDAVTester/trunk/src/xmlDefs.py</a></li>
<li><a href="#CalDAVTestertrunkverifiersaclItemspy">CalDAVTester/trunk/verifiers/aclItems.py</a></li>
<li><a href="#CalDAVTestertrunkverifiersaddressDataMatchpy">CalDAVTester/trunk/verifiers/addressDataMatch.py</a></li>
<li><a href="#CalDAVTestertrunkverifierscalendarDataMatchpy">CalDAVTester/trunk/verifiers/calendarDataMatch.py</a></li>
<li><a href="#CalDAVTestertrunkverifiersdataMatchpy">CalDAVTester/trunk/verifiers/dataMatch.py</a></li>
<li><a href="#CalDAVTestertrunkverifiersjsonPointerMatchpy">CalDAVTester/trunk/verifiers/jsonPointerMatch.py</a></li>
<li><a href="#CalDAVTestertrunkverifiersmultistatusItemspy">CalDAVTester/trunk/verifiers/multistatusItems.py</a></li>
<li><a href="#CalDAVTestertrunkverifierspropfindItemspy">CalDAVTester/trunk/verifiers/propfindItems.py</a></li>
<li><a href="#CalDAVTestertrunkverifierspropfindValuespy">CalDAVTester/trunk/verifiers/propfindValues.py</a></li>
<li><a href="#CalDAVTestertrunkverifiersxmlDataMatchpy">CalDAVTester/trunk/verifiers/xmlDataMatch.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalDAVTestertrunkREADMEtxt"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/README.txt (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/README.txt        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/README.txt        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -15,6 +15,7 @@
</span><span class="cx"> testcaldav.py \
</span><span class="cx">         [-s filename] \
</span><span class="cx">         [-x dirpath] \
</span><ins>+        [--basedir dirpath] \
</ins><span class="cx">         [--ssl] \
</span><span class="cx">         [--all] \
</span><span class="cx">         [--random] \
</span><span class="lines">@@ -33,6 +34,9 @@
</span><span class="cx">         -x : directory path for test scripts
</span><span class="cx">         (default is 'scripts/tests').
</span><span class="cx">
</span><ins>+        --basedir : directory path for serverinfo.xml, test/ and data/,
+                overrides -s and -x values
+
</ins><span class="cx">         -p : filename specifies the file to use to populate the server with
</span><span class="cx">         data. Server data population only occurs when this option is
</span><span class="cx">         present.
</span></span></pre></div>
<a id="CalDAVTestertrunkscriptstestsCalDAVcaldavtestdtd"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/scripts/tests/CalDAV/caldavtest.dtd (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/scripts/tests/CalDAV/caldavtest.dtd        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/scripts/tests/CalDAV/caldavtest.dtd        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx">         <!ELEMENT pause EMPTY>
</span><span class="cx">
</span><span class="cx">         <!ELEMENT request (require-feature?, exclude-feature?, method, ruri*, header*, data?, verify*,
</span><del>-                                                graburi?, grabcount?, grabheader*, grabproperty*, grabelement*, grabcalproperty*, grabcalparameter*)>
</del><ins>+                                                graburi?, grabcount?, grabheader*, grabproperty*, grabelement*, grabjson*, grabcalproperty*, grabcalparameter*)>
</ins><span class="cx">                 <!ATTLIST request host2 (yes|no) "no"
</span><span class="cx">                                                  auth (yes|no) "yes"
</span><span class="cx">                                                  user CDATA ""
</span><span class="lines">@@ -70,6 +70,8 @@
</span><span class="cx">
</span><span class="cx">                 <!ELEMENT grabelement (name, parent*, variable+)>
</span><span class="cx">
</span><ins>+                <!ELEMENT grabjson (pointer, variable+)>
+
</ins><span class="cx">                 <!ELEMENT grabcalproperty (name, variable)>
</span><span class="cx">                 <!ELEMENT grabcalparameter (name, variable)>
</span><span class="cx">
</span></span></pre></div>
<a id="CalDAVTestertrunkscriptstestsCardDAVcaldavtestdtd"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/scripts/tests/CardDAV/caldavtest.dtd (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/scripts/tests/CardDAV/caldavtest.dtd        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/scripts/tests/CardDAV/caldavtest.dtd        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx">         <!ELEMENT pause EMPTY>
</span><span class="cx">
</span><span class="cx">         <!ELEMENT request (require-feature?, exclude-feature?, method, ruri*, header*, data?, verify*,
</span><del>-                                                graburi?, grabcount?, grabheader*, grabproperty*, grabelement*, grabcalproperty*, grabcalparameter*)>
</del><ins>+                                                graburi?, grabcount?, grabheader*, grabproperty*, grabelement*, grabjson*, grabcalproperty*, grabcalparameter*)>
</ins><span class="cx">                 <!ATTLIST request host2 (yes|no) "no"
</span><span class="cx">                                                  auth (yes|no) "yes"
</span><span class="cx">                                                  user CDATA ""
</span><span class="lines">@@ -70,6 +70,8 @@
</span><span class="cx">
</span><span class="cx">                 <!ELEMENT grabelement (name, parent*, variable+)>
</span><span class="cx">
</span><ins>+                <!ELEMENT grabjson (pointer, variable+)>
+
</ins><span class="cx">                 <!ELEMENT grabcalproperty (name, variable)>
</span><span class="cx">                 <!ELEMENT grabcalparameter (name, variable)>
</span><span class="cx">
</span></span></pre></div>
<a id="CalDAVTestertrunkscriptstestspodCalDAVcaldavtestdtd"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/scripts/tests-pod/CalDAV/caldavtest.dtd (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/scripts/tests-pod/CalDAV/caldavtest.dtd        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/scripts/tests-pod/CalDAV/caldavtest.dtd        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx">         <!ELEMENT pause EMPTY>
</span><span class="cx">
</span><span class="cx">         <!ELEMENT request (require-feature?, exclude-feature?, method, ruri*, header*, data?, verify*,
</span><del>-                                                graburi?, grabcount?, grabheader*, grabproperty*, grabelement*, grabcalproperty*, grabcalparameter*)>
</del><ins>+                                                graburi?, grabcount?, grabheader*, grabproperty*, grabelement*, grabjson*, grabcalproperty*, grabcalparameter*)>
</ins><span class="cx">                 <!ATTLIST request host2 (yes|no) "no"
</span><span class="cx">                                                  auth (yes|no) "yes"
</span><span class="cx">                                                  user CDATA ""
</span><span class="lines">@@ -70,6 +70,8 @@
</span><span class="cx">
</span><span class="cx">                 <!ELEMENT grabelement (name, parent*, variable+)>
</span><span class="cx">
</span><ins>+                <!ELEMENT grabjson (pointer, variable+)>
+
</ins><span class="cx">                 <!ELEMENT grabcalproperty (name, variable)>
</span><span class="cx">                 <!ELEMENT grabcalparameter (name, variable)>
</span><span class="cx">
</span></span></pre></div>
<a id="CalDAVTestertrunksrccaldavtestpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/src/caldavtest.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/src/caldavtest.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/src/caldavtest.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx"> from cStringIO import StringIO
</span><span class="cx"> from pycalendar.icalendar.calendar import Calendar
</span><span class="cx"> from src.httpshandler import SmartHTTPConnection
</span><ins>+from src.jsonPointer import JSONMatcher
</ins><span class="cx"> from src.manager import manager
</span><span class="cx"> from src.request import data, pause
</span><span class="cx"> from src.request import request
</span><span class="lines">@@ -30,6 +31,7 @@
</span><span class="cx"> from xml.etree.cElementTree import ElementTree, tostring
</span><span class="cx"> import commands
</span><span class="cx"> import httplib
</span><ins>+import json
</ins><span class="cx"> import os
</span><span class="cx"> import rfc822
</span><span class="cx"> import socket
</span><span class="lines">@@ -744,6 +746,20 @@
</span><span class="cx"> for variable, elementvalue in zip(variables, elementvalues):
</span><span class="cx"> self.manager.server_info.addextrasubs({variable: elementvalue.encode("utf-8") if elementvalue else ""})
</span><span class="cx">
</span><ins>+ if req.grabjson:
+ for pointer, variables in req.grabjson:
+ # grab the JSON value here
+ pointervalues = self.extractPointer(pointer, respdata)
+ if pointervalues == None:
+ result = False
+ resulttxt += "\Pointer %s was not extracted from response\n" % (pointer,)
+ elif len(variables) != len(pointervalues):
+ result = False
+ resulttxt += "\n%d found but expecting %d for pointer %s from response\n" % (len(pointervalues), len(variables), pointer,)
+ else:
+ for variable, pointervalue in zip(variables, pointervalues):
+ self.manager.server_info.addextrasubs({variable: pointervalue.encode("utf-8") if pointervalue else ""})
+
</ins><span class="cx"> if req.grabcalprop:
</span><span class="cx"> for propname, variable in req.grabcalprop:
</span><span class="cx"> # grab the property here
</span><span class="lines">@@ -950,6 +966,18 @@
</span><span class="cx"> return None
</span><span class="cx">
</span><span class="cx">
</span><ins>+ def extractPointer(self, pointer, respdata):
+
+ jp = JSONMatcher(pointer)
+
+ try:
+ j = json.loads(respdata)
+ except:
+ return None
+
+ return jp.match(j)
+
+
</ins><span class="cx"> def extractCalProperty(self, propertyname, respdata):
</span><span class="cx">
</span><span class="cx"> prop = self._calProperty(propertyname, respdata)
</span></span></pre></div>
<a id="CalDAVTestertrunksrcmanagerpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/src/manager.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/src/manager.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/src/manager.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx">
</span><span class="cx"> def __init__(self, text=True):
</span><span class="cx"> self.server_info = serverinfo()
</span><ins>+ self.data_dir = None
</ins><span class="cx"> self.pretest = None
</span><span class="cx"> self.posttest = None
</span><span class="cx"> self.tests = []
</span><span class="lines">@@ -210,6 +211,7 @@
</span><span class="cx"> def readCommandLine(self):
</span><span class="cx"> sname = "scripts/server/serverinfo.xml"
</span><span class="cx"> dname = "scripts/tests"
</span><ins>+ basedir = None
</ins><span class="cx"> fnames = []
</span><span class="cx"> ssl = False
</span><span class="cx"> all = False
</span><span class="lines">@@ -226,6 +228,7 @@
</span><span class="cx"> [
</span><span class="cx"> "ssl",
</span><span class="cx"> "all",
</span><ins>+ "basedir=",
</ins><span class="cx"> "subdir=",
</span><span class="cx"> "exclude=",
</span><span class="cx"> "pretest=",
</span><span class="lines">@@ -253,6 +256,11 @@
</span><span class="cx"> ssl = True
</span><span class="cx"> elif option == "--all":
</span><span class="cx"> all = True
</span><ins>+ elif option == "--basedir":
+ basedir = value
+ sname = os.path.join(basedir, "serverinfo.xml")
+ dname = os.path.join(basedir, "tests")
+ self.data_dir = os.path.join(basedir, "data")
</ins><span class="cx"> elif option == "--subdir":
</span><span class="cx"> subdir = value + "/"
</span><span class="cx"> elif option == "--exclude":
</span></span></pre></div>
<a id="CalDAVTestertrunksrcrequestpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/src/request.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/src/request.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/src/request.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -167,6 +167,7 @@
</span><span class="cx"> self.grabheader = []
</span><span class="cx"> self.grabproperty = []
</span><span class="cx"> self.grabelement = []
</span><ins>+ self.grabjson = []
</ins><span class="cx"> self.grabcalprop = []
</span><span class="cx"> self.grabcalparam = []
</span><span class="cx">
</span><span class="lines">@@ -289,7 +290,7 @@
</span><span class="cx">
</span><span class="cx"> def getFilePath(self):
</span><span class="cx"> if self.data != None:
</span><del>- return self.data.filepath
</del><ins>+ return os.path.join(self.manager.data_dir, self.data.filepath) if self.manager.data_dir else self.data.filepath
</ins><span class="cx"> else:
</span><span class="cx"> return ""
</span><span class="cx">
</span><span class="lines">@@ -301,7 +302,7 @@
</span><span class="cx"> data = self.data.value
</span><span class="cx"> else:
</span><span class="cx"> # read in the file data
</span><del>- fd = open(self.data.nextpath if hasattr(self.data, "nextpath") else self.data.filepath, "r")
</del><ins>+ fd = open(self.data.nextpath if hasattr(self.data, "nextpath") else self.getFilePath(), "r")
</ins><span class="cx"> try:
</span><span class="cx"> data = fd.read()
</span><span class="cx"> finally:
</span><span class="lines">@@ -319,9 +320,9 @@
</span><span class="cx">
</span><span class="cx"> def getNextData(self):
</span><span class="cx"> if not hasattr(self, "dataList"):
</span><del>- self.dataList = sorted([path for path in os.listdir(self.data.filepath) if not path.startswith(".")])
</del><ins>+ self.dataList = sorted([path for path in os.listdir(self.getFilePath()) if not path.startswith(".")])
</ins><span class="cx"> if len(self.dataList):
</span><del>- self.data.nextpath = os.path.join(self.data.filepath, self.dataList.pop(0))
</del><ins>+ self.data.nextpath = os.path.join(self.getFilePath(), self.dataList.pop(0))
</ins><span class="cx"> return True
</span><span class="cx"> else:
</span><span class="cx"> if hasattr(self.data, "nextpath"):
</span><span class="lines">@@ -332,7 +333,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def hasNextData(self):
</span><del>- dataList = sorted([path for path in os.listdir(self.data.filepath) if not path.startswith(".")])
</del><ins>+ dataList = sorted([path for path in os.listdir(self.getFilePath()) if not path.startswith(".")])
</ins><span class="cx"> return len(dataList) != 0
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -398,6 +399,8 @@
</span><span class="cx"> self.parseGrab(child, self.grabproperty)
</span><span class="cx"> elif child.tag == src.xmlDefs.ELEMENT_GRABELEMENT:
</span><span class="cx"> self.parseMultiGrab(child, self.grabelement)
</span><ins>+ elif child.tag == src.xmlDefs.ELEMENT_GRABJSON:
+ self.parseMultiGrab(child, self.grabjson)
</ins><span class="cx"> elif child.tag == src.xmlDefs.ELEMENT_GRABCALPROP:
</span><span class="cx"> self.parseGrab(child, self.grabcalprop)
</span><span class="cx"> elif child.tag == src.xmlDefs.ELEMENT_GRABCALPARAM:
</span><span class="lines">@@ -457,7 +460,7 @@
</span><span class="cx"> parent = None
</span><span class="cx"> variable = None
</span><span class="cx"> for child in node.getchildren():
</span><del>- if child.tag in (src.xmlDefs.ELEMENT_NAME, src.xmlDefs.ELEMENT_PROPERTY):
</del><ins>+ if child.tag in (src.xmlDefs.ELEMENT_NAME, src.xmlDefs.ELEMENT_PROPERTY, src.xmlDefs.ELEMENT_POINTER):
</ins><span class="cx"> name = self.manager.server_info.subs(child.text.encode("utf-8"))
</span><span class="cx"> elif child.tag == src.xmlDefs.ELEMENT_PARENT:
</span><span class="cx"> parent = self.manager.server_info.subs(child.text.encode("utf-8"))
</span></span></pre></div>
<a id="CalDAVTestertrunksrcserverinfopy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/src/serverinfo.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/src/serverinfo.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/src/serverinfo.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -206,12 +206,14 @@
</span><span class="cx"> self.subsdict[k] = v
</span><span class="cx">
</span><span class="cx"> # Now cache some useful substitutions
</span><del>- if "$userid1:" not in self.subsdict:
- raise ValueError("Must have $userid1: substitution")
- self.user = self.subsdict["$userid1:"]
- if "$pswd1:" not in self.subsdict:
- raise ValueError("Must have $pswd1: substitution")
- self.pswd = self.subsdict["$pswd1:"]
</del><ins>+ user = "$userid1:" if "$userid1:" in self.subsdict else "$userid01:"
+ pswd = "$pswd1:" if "$pswd1:" in self.subsdict else "$pswd01:"
+ if user not in self.subsdict:
+ raise ValueError("Must have userid substitution")
+ self.user = self.subsdict[user]
+ if pswd not in self.subsdict:
+ raise ValueError("Must have pswd substitution")
+ self.pswd = self.subsdict[pswd]
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def parseRepeatXML(self, node):
</span></span></pre></div>
<a id="CalDAVTestertrunksrcxmlDefspy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/src/xmlDefs.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/src/xmlDefs.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/src/xmlDefs.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> ELEMENT_GRABCOUNT = "grabcount"
</span><span class="cx"> ELEMENT_GRABELEMENT = "grabelement"
</span><span class="cx"> ELEMENT_GRABHEADER = "grabheader"
</span><ins>+ELEMENT_GRABJSON = "grabjson"
</ins><span class="cx"> ELEMENT_GRABPROPERTY = "grabproperty"
</span><span class="cx"> ELEMENT_GRABURI = "graburi"
</span><span class="cx"> ELEMENT_HEADER = "header"
</span><span class="lines">@@ -52,6 +53,7 @@
</span><span class="cx"> ELEMENT_PARENT = "parent"
</span><span class="cx"> ELEMENT_PAUSE = "pause"
</span><span class="cx"> ELEMENT_PERIOD = "period"
</span><ins>+ELEMENT_POINTER = "pointer"
</ins><span class="cx"> ELEMENT_PROPERTY = "property"
</span><span class="cx"> ELEMENT_REPEAT = "repeat"
</span><span class="cx"> ELEMENT_REQUEST = "request"
</span></span></pre></div>
<a id="CalDAVTestertrunkverifiersaclItemspy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/aclItems.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/aclItems.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/verifiers/aclItems.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -13,7 +13,6 @@
</span><span class="cx"> # See the License for the specific language governing permissions and
</span><span class="cx"> # limitations under the License.
</span><span class="cx"> ##
</span><del>-import urllib
</del><span class="cx">
</span><span class="cx"> """
</span><span class="cx"> Verifier that checks a propfind response to make sure that the specified ACL privileges
</span><span class="lines">@@ -22,6 +21,7 @@
</span><span class="cx">
</span><span class="cx"> from xml.etree.cElementTree import ElementTree
</span><span class="cx"> from StringIO import StringIO
</span><ins>+import urllib
</ins><span class="cx">
</span><span class="cx"> class Verifier(object):
</span><span class="cx">
</span></span></pre></div>
<a id="CalDAVTestertrunkverifiersaddressDataMatchpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/addressDataMatch.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/addressDataMatch.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/verifiers/addressDataMatch.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -16,6 +16,7 @@
</span><span class="cx">
</span><span class="cx"> from difflib import unified_diff
</span><span class="cx"> from pycalendar.vcard.card import Card
</span><ins>+import os
</ins><span class="cx">
</span><span class="cx"> """
</span><span class="cx"> Verifier that checks the response body for a semantic match to data in a file.
</span><span class="lines">@@ -26,6 +27,8 @@
</span><span class="cx"> def verify(self, manager, uri, response, respdata, args, is_json=False): #@UnusedVariable
</span><span class="cx"> # Get arguments
</span><span class="cx"> files = args.get("filepath", [])
</span><ins>+ if manager.data_dir:
+ files = map(lambda x: os.path.join(manager.data_dir, x), files)
</ins><span class="cx"> carddata = args.get("data", [])
</span><span class="cx"> filters = args.get("filter", [])
</span><span class="cx">
</span></span></pre></div>
<a id="CalDAVTestertrunkverifierscalendarDataMatchpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/calendarDataMatch.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/calendarDataMatch.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/verifiers/calendarDataMatch.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -17,6 +17,7 @@
</span><span class="cx"> from difflib import unified_diff
</span><span class="cx"> from pycalendar.icalendar.calendar import Calendar
</span><span class="cx"> from pycalendar.parameter import Parameter
</span><ins>+import os
</ins><span class="cx">
</span><span class="cx"> """
</span><span class="cx"> Verifier that checks the response body for a semantic match to data in a file.
</span><span class="lines">@@ -27,6 +28,8 @@
</span><span class="cx"> def verify(self, manager, uri, response, respdata, args, is_json=False): #@UnusedVariable
</span><span class="cx"> # Get arguments
</span><span class="cx"> files = args.get("filepath", [])
</span><ins>+ if manager.data_dir:
+ files = map(lambda x: os.path.join(manager.data_dir, x), files)
</ins><span class="cx"> caldata = args.get("data", [])
</span><span class="cx"> filters = args.get("filter", [])
</span><span class="cx"> statusCode = args.get("status", ["200", "201", "207"])
</span></span></pre></div>
<a id="CalDAVTestertrunkverifiersdataMatchpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/dataMatch.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/dataMatch.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/verifiers/dataMatch.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -13,20 +13,23 @@
</span><span class="cx"> # See the License for the specific language governing permissions and
</span><span class="cx"> # limitations under the License.
</span><span class="cx"> ##
</span><del>-from difflib import unified_diff
</del><span class="cx">
</span><span class="cx"> """
</span><span class="cx"> Verifier that checks the response body for an exact match to data in a file.
</span><span class="cx"> """
</span><span class="cx">
</span><ins>+from StringIO import StringIO
+from difflib import unified_diff
</ins><span class="cx"> from xml.etree.cElementTree import ElementTree, tostring
</span><del>-from StringIO import StringIO
</del><ins>+import os
</ins><span class="cx">
</span><span class="cx"> class Verifier(object):
</span><span class="cx">
</span><span class="cx"> def verify(self, manager, uri, response, respdata, args): #@UnusedVariable
</span><span class="cx"> # Get arguments
</span><span class="cx"> files = args.get("filepath", [])
</span><ins>+ if manager.data_dir:
+ files = map(lambda x: os.path.join(manager.data_dir, x), files)
</ins><span class="cx">
</span><span class="cx"> # status code must be 200, 207
</span><span class="cx"> if response.status not in (200, 207):
</span></span></pre></div>
<a id="CalDAVTestertrunkverifiersjsonPointerMatchpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/jsonPointerMatch.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/jsonPointerMatch.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/verifiers/jsonPointerMatch.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -86,18 +86,23 @@
</span><span class="cx"> resulttxt += " Items not returned in JSON for %s\n" % (path,)
</span><span class="cx">
</span><span class="cx"> for jpath in notexists:
</span><ins>+ if jpath.find("~$") != -1:
+ path, value = jpath.split("~$")
+ else:
+ path, value = jpath, None
</ins><span class="cx"> try:
</span><del>- jp = JSONMatcher(jpath)
</del><ins>+ jp = JSONMatcher(path)
</ins><span class="cx"> except Exception:
</span><span class="cx"> result = False
</span><span class="cx"> resulttxt += " Invalid JSON pointer for %s\n" % (jpath,)
</span><span class="cx"> else:
</span><span class="cx"> try:
</span><del>- jp.match(j)
</del><ins>+ jobjs = jp.match(j)
</ins><span class="cx"> except JSONPointerMatchError:
</span><span class="cx"> pass
</span><span class="cx"> else:
</span><del>- resulttxt += " Items returned in JSON for %s\n" % (jpath,)
- result = False
</del><ins>+ if len(jobjs):
+ resulttxt += " Items returned in JSON for %s\n" % (jpath,)
+ result = False
</ins><span class="cx">
</span><span class="cx"> return result, resulttxt
</span></span></pre></div>
<a id="CalDAVTestertrunkverifiersmultistatusItemspy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/multistatusItems.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/multistatusItems.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/verifiers/multistatusItems.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -13,7 +13,6 @@
</span><span class="cx"> # See the License for the specific language governing permissions and
</span><span class="cx"> # limitations under the License.
</span><span class="cx"> ##
</span><del>-import urllib
</del><span class="cx">
</span><span class="cx"> """
</span><span class="cx"> Verifier that checks a multistatus response to make sure that the specified hrefs
</span><span class="lines">@@ -22,6 +21,7 @@
</span><span class="cx">
</span><span class="cx"> from xml.etree.cElementTree import ElementTree
</span><span class="cx"> from StringIO import StringIO
</span><ins>+import urllib
</ins><span class="cx">
</span><span class="cx"> class Verifier(object):
</span><span class="cx">
</span></span></pre></div>
<a id="CalDAVTestertrunkverifierspropfindItemspy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/propfindItems.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/propfindItems.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/verifiers/propfindItems.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -13,7 +13,6 @@
</span><span class="cx"> # See the License for the specific language governing permissions and
</span><span class="cx"> # limitations under the License.
</span><span class="cx"> ##
</span><del>-import urllib
</del><span class="cx">
</span><span class="cx"> """
</span><span class="cx"> Verifier that checks a propfind response to make sure that the specified properties
</span><span class="lines">@@ -22,6 +21,7 @@
</span><span class="cx">
</span><span class="cx"> from xml.etree.cElementTree import ElementTree, tostring
</span><span class="cx"> from StringIO import StringIO
</span><ins>+import urllib
</ins><span class="cx">
</span><span class="cx"> class Verifier(object):
</span><span class="cx"> """
</span></span></pre></div>
<a id="CalDAVTestertrunkverifierspropfindValuespy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/propfindValues.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/propfindValues.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/verifiers/propfindValues.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -13,7 +13,6 @@
</span><span class="cx"> # See the License for the specific language governing permissions and
</span><span class="cx"> # limitations under the License.
</span><span class="cx"> ##
</span><del>-import urllib
</del><span class="cx">
</span><span class="cx"> """
</span><span class="cx"> Verifier that checks a propfind response for regex matches to property values.
</span><span class="lines">@@ -22,6 +21,7 @@
</span><span class="cx"> from xml.etree.cElementTree import ElementTree, tostring
</span><span class="cx"> from StringIO import StringIO
</span><span class="cx"> import re
</span><ins>+import urllib
</ins><span class="cx">
</span><span class="cx"> class Verifier(object):
</span><span class="cx">
</span></span></pre></div>
<a id="CalDAVTestertrunkverifiersxmlDataMatchpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/xmlDataMatch.py (14195 => 14196)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/xmlDataMatch.py        2014-12-04 18:11:04 UTC (rev 14195)
+++ CalDAVTester/trunk/verifiers/xmlDataMatch.py        2014-12-04 20:45:50 UTC (rev 14196)
</span><span class="lines">@@ -21,12 +21,15 @@
</span><span class="cx"> from difflib import unified_diff
</span><span class="cx"> from xml.etree.cElementTree import ElementTree, tostring
</span><span class="cx"> import StringIO
</span><ins>+import os
</ins><span class="cx">
</span><span class="cx"> class Verifier(object):
</span><span class="cx">
</span><span class="cx"> def verify(self, manager, uri, response, respdata, args): #@UnusedVariable
</span><span class="cx"> # Get arguments
</span><span class="cx"> files = args.get("filepath", [])
</span><ins>+ if manager.data_dir:
+ files = map(lambda x: os.path.join(manager.data_dir, x), files)
</ins><span class="cx"> filters = args.get("filter", [])
</span><span class="cx">
</span><span class="cx"> # status code must be 200, 207
</span></span></pre>
</div>
</div>
</body>
</html>