<!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">         &lt;!ELEMENT pause EMPTY&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;!ELEMENT request (require-feature?, exclude-feature?, method, ruri*, header*, data?, verify*,
</span><del>-                                                graburi?, grabcount?, grabheader*, grabproperty*, grabelement*, grabcalproperty*, grabcalparameter*)&gt;
</del><ins>+                                                graburi?, grabcount?, grabheader*, grabproperty*, grabelement*, grabjson*, grabcalproperty*, grabcalparameter*)&gt;
</ins><span class="cx">                 &lt;!ATTLIST request host2 (yes|no) &quot;no&quot;
</span><span class="cx">                                                  auth (yes|no) &quot;yes&quot;
</span><span class="cx">                                                  user CDATA &quot;&quot;
</span><span class="lines">@@ -70,6 +70,8 @@
</span><span class="cx"> 
</span><span class="cx">                 &lt;!ELEMENT grabelement (name, parent*, variable+)&gt;
</span><span class="cx"> 
</span><ins>+                &lt;!ELEMENT grabjson (pointer, variable+)&gt;
+
</ins><span class="cx">                 &lt;!ELEMENT grabcalproperty (name, variable)&gt;
</span><span class="cx">                 &lt;!ELEMENT grabcalparameter (name, variable)&gt;
</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">         &lt;!ELEMENT pause EMPTY&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;!ELEMENT request (require-feature?, exclude-feature?, method, ruri*, header*, data?, verify*,
</span><del>-                                                graburi?, grabcount?, grabheader*, grabproperty*, grabelement*, grabcalproperty*, grabcalparameter*)&gt;
</del><ins>+                                                graburi?, grabcount?, grabheader*, grabproperty*, grabelement*, grabjson*, grabcalproperty*, grabcalparameter*)&gt;
</ins><span class="cx">                 &lt;!ATTLIST request host2 (yes|no) &quot;no&quot;
</span><span class="cx">                                                  auth (yes|no) &quot;yes&quot;
</span><span class="cx">                                                  user CDATA &quot;&quot;
</span><span class="lines">@@ -70,6 +70,8 @@
</span><span class="cx"> 
</span><span class="cx">                 &lt;!ELEMENT grabelement (name, parent*, variable+)&gt;
</span><span class="cx"> 
</span><ins>+                &lt;!ELEMENT grabjson (pointer, variable+)&gt;
+
</ins><span class="cx">                 &lt;!ELEMENT grabcalproperty (name, variable)&gt;
</span><span class="cx">                 &lt;!ELEMENT grabcalparameter (name, variable)&gt;
</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">         &lt;!ELEMENT pause EMPTY&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;!ELEMENT request (require-feature?, exclude-feature?, method, ruri*, header*, data?, verify*,
</span><del>-                                                graburi?, grabcount?, grabheader*, grabproperty*, grabelement*, grabcalproperty*, grabcalparameter*)&gt;
</del><ins>+                                                graburi?, grabcount?, grabheader*, grabproperty*, grabelement*, grabjson*, grabcalproperty*, grabcalparameter*)&gt;
</ins><span class="cx">                 &lt;!ATTLIST request host2 (yes|no) &quot;no&quot;
</span><span class="cx">                                                  auth (yes|no) &quot;yes&quot;
</span><span class="cx">                                                  user CDATA &quot;&quot;
</span><span class="lines">@@ -70,6 +70,8 @@
</span><span class="cx"> 
</span><span class="cx">                 &lt;!ELEMENT grabelement (name, parent*, variable+)&gt;
</span><span class="cx"> 
</span><ins>+                &lt;!ELEMENT grabjson (pointer, variable+)&gt;
+
</ins><span class="cx">                 &lt;!ELEMENT grabcalproperty (name, variable)&gt;
</span><span class="cx">                 &lt;!ELEMENT grabcalparameter (name, variable)&gt;
</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(&quot;utf-8&quot;) if elementvalue else &quot;&quot;})
</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 += &quot;\Pointer %s was not extracted from response\n&quot; % (pointer,)
+                elif len(variables) != len(pointervalues):
+                    result = False
+                    resulttxt += &quot;\n%d found but expecting %d for pointer %s from response\n&quot; % (len(pointervalues), len(variables), pointer,)
+                else:
+                    for variable, pointervalue in zip(variables, pointervalues):
+                        self.manager.server_info.addextrasubs({variable: pointervalue.encode(&quot;utf-8&quot;) if pointervalue else &quot;&quot;})
+
</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 = &quot;scripts/server/serverinfo.xml&quot;
</span><span class="cx">         dname = &quot;scripts/tests&quot;
</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">                 &quot;ssl&quot;,
</span><span class="cx">                 &quot;all&quot;,
</span><ins>+                &quot;basedir=&quot;,
</ins><span class="cx">                 &quot;subdir=&quot;,
</span><span class="cx">                 &quot;exclude=&quot;,
</span><span class="cx">                 &quot;pretest=&quot;,
</span><span class="lines">@@ -253,6 +256,11 @@
</span><span class="cx">                 ssl = True
</span><span class="cx">             elif option == &quot;--all&quot;:
</span><span class="cx">                 all = True
</span><ins>+            elif option == &quot;--basedir&quot;:
+                basedir = value
+                sname = os.path.join(basedir, &quot;serverinfo.xml&quot;)
+                dname = os.path.join(basedir, &quot;tests&quot;)
+                self.data_dir = os.path.join(basedir, &quot;data&quot;)
</ins><span class="cx">             elif option == &quot;--subdir&quot;:
</span><span class="cx">                 subdir = value + &quot;/&quot;
</span><span class="cx">             elif option == &quot;--exclude&quot;:
</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 &quot;&quot;
</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, &quot;nextpath&quot;) else self.data.filepath, &quot;r&quot;)
</del><ins>+                fd = open(self.data.nextpath if hasattr(self.data, &quot;nextpath&quot;) else self.getFilePath(), &quot;r&quot;)
</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, &quot;dataList&quot;):
</span><del>-            self.dataList = sorted([path for path in os.listdir(self.data.filepath) if not path.startswith(&quot;.&quot;)])
</del><ins>+            self.dataList = sorted([path for path in os.listdir(self.getFilePath()) if not path.startswith(&quot;.&quot;)])
</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, &quot;nextpath&quot;):
</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(&quot;.&quot;)])
</del><ins>+        dataList = sorted([path for path in os.listdir(self.getFilePath()) if not path.startswith(&quot;.&quot;)])
</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(&quot;utf-8&quot;))
</span><span class="cx">             elif child.tag == src.xmlDefs.ELEMENT_PARENT:
</span><span class="cx">                 parent = self.manager.server_info.subs(child.text.encode(&quot;utf-8&quot;))
</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 &quot;$userid1:&quot; not in self.subsdict:
-            raise ValueError(&quot;Must have $userid1: substitution&quot;)
-        self.user = self.subsdict[&quot;$userid1:&quot;]
-        if &quot;$pswd1:&quot; not in self.subsdict:
-            raise ValueError(&quot;Must have $pswd1: substitution&quot;)
-        self.pswd = self.subsdict[&quot;$pswd1:&quot;]
</del><ins>+        user = &quot;$userid1:&quot; if &quot;$userid1:&quot; in self.subsdict else &quot;$userid01:&quot;
+        pswd = &quot;$pswd1:&quot; if &quot;$pswd1:&quot; in self.subsdict else &quot;$pswd01:&quot;
+        if user not in self.subsdict:
+            raise ValueError(&quot;Must have userid substitution&quot;)
+        self.user = self.subsdict[user]
+        if pswd not in self.subsdict:
+            raise ValueError(&quot;Must have pswd substitution&quot;)
+        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 = &quot;grabcount&quot;
</span><span class="cx"> ELEMENT_GRABELEMENT = &quot;grabelement&quot;
</span><span class="cx"> ELEMENT_GRABHEADER = &quot;grabheader&quot;
</span><ins>+ELEMENT_GRABJSON = &quot;grabjson&quot;
</ins><span class="cx"> ELEMENT_GRABPROPERTY = &quot;grabproperty&quot;
</span><span class="cx"> ELEMENT_GRABURI = &quot;graburi&quot;
</span><span class="cx"> ELEMENT_HEADER = &quot;header&quot;
</span><span class="lines">@@ -52,6 +53,7 @@
</span><span class="cx"> ELEMENT_PARENT = &quot;parent&quot;
</span><span class="cx"> ELEMENT_PAUSE = &quot;pause&quot;
</span><span class="cx"> ELEMENT_PERIOD = &quot;period&quot;
</span><ins>+ELEMENT_POINTER = &quot;pointer&quot;
</ins><span class="cx"> ELEMENT_PROPERTY = &quot;property&quot;
</span><span class="cx"> ELEMENT_REPEAT = &quot;repeat&quot;
</span><span class="cx"> ELEMENT_REQUEST = &quot;request&quot;
</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"> &quot;&quot;&quot;
</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"> &quot;&quot;&quot;
</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(&quot;filepath&quot;, [])
</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(&quot;data&quot;, [])
</span><span class="cx">         filters = args.get(&quot;filter&quot;, [])
</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"> &quot;&quot;&quot;
</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(&quot;filepath&quot;, [])
</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(&quot;data&quot;, [])
</span><span class="cx">         filters = args.get(&quot;filter&quot;, [])
</span><span class="cx">         statusCode = args.get(&quot;status&quot;, [&quot;200&quot;, &quot;201&quot;, &quot;207&quot;])
</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"> &quot;&quot;&quot;
</span><span class="cx"> Verifier that checks the response body for an exact match to data in a file.
</span><span class="cx"> &quot;&quot;&quot;
</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(&quot;filepath&quot;, [])
</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 += &quot;        Items not returned in JSON for %s\n&quot; % (path,)
</span><span class="cx"> 
</span><span class="cx">         for jpath in notexists:
</span><ins>+            if jpath.find(&quot;~$&quot;) != -1:
+                path, value = jpath.split(&quot;~$&quot;)
+            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 += &quot;        Invalid JSON pointer for %s\n&quot; % (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 += &quot;        Items returned in JSON for %s\n&quot; % (jpath,)
-                    result = False
</del><ins>+                    if len(jobjs):
+                        resulttxt += &quot;        Items returned in JSON for %s\n&quot; % (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"> &quot;&quot;&quot;
</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"> &quot;&quot;&quot;
</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">     &quot;&quot;&quot;
</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"> &quot;&quot;&quot;
</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(&quot;filepath&quot;, [])
</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(&quot;filter&quot;, [])
</span><span class="cx"> 
</span><span class="cx">         # status code must be 200, 207
</span></span></pre>
</div>
</div>

</body>
</html>