<!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>[15663] 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/15663">15663</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2016-06-09 14:06:10 -0700 (Thu, 09 Jun 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Display request/response if requested in the log observer. Provide a way to test for JSON null values.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalDAVTestertrunkREADMEtxt">CalDAVTester/trunk/README.txt</a></li>
<li><a href="#CalDAVTestertrunksrccaldavtestpy">CalDAVTester/trunk/src/caldavtest.py</a></li>
<li><a href="#CalDAVTestertrunksrcobserversbasepy">CalDAVTester/trunk/src/observers/base.py</a></li>
<li><a href="#CalDAVTestertrunksrcobserverslogpy">CalDAVTester/trunk/src/observers/log.py</a></li>
<li><a href="#CalDAVTestertrunkverifiersjsonPointerMatchpy">CalDAVTester/trunk/verifiers/jsonPointerMatch.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalDAVTestertrunkREADMEtxt"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/README.txt (15662 => 15663)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/README.txt        2016-06-09 20:52:09 UTC (rev 15662)
+++ CalDAVTester/trunk/README.txt        2016-06-09 21:06:10 UTC (rev 15663)
</span><span class="lines">@@ -617,9 +617,9 @@
</span><span class="cx">         is a match, otherwise False.
</span><span class="cx">         The pointer is the absolute pointer from the root down. A JSON object's
</span><span class="cx">         string value can be checked by append "~$" and the string value to test
</span><del>-        to the JSON pointer value. A single "." can be used as a reference-token
-        in the JSON pointer to match against any member or array item at that
-        position in the document.
</del><ins>+        to the JSON pointer value. To test for a null value append "~~". A single
+        "." can be used as a reference-token in the JSON pointer to match against
+        any member or array item at that position in the document.
</ins><span class="cx">         
</span><span class="cx">         Argument: 'exists'
</span><span class="cx">                 JSON pointer for a JSON item to check the presence of
</span></span></pre></div>
<a id="CalDAVTestertrunksrccaldavtestpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/src/caldavtest.py (15662 => 15663)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/src/caldavtest.py        2016-06-09 20:52:09 UTC (rev 15662)
+++ CalDAVTester/trunk/src/caldavtest.py        2016-06-09 21:06:10 UTC (rev 15663)
</span><span class="lines">@@ -769,15 +769,17 @@
</span><span class="cx"> resulttxt += "Status Code Error: %d" % response.status
</span><span class="cx">
</span><span class="cx"> if req.print_request or (self.manager.print_request_response_on_error and not result):
</span><del>- resulttxt += "\n-------BEGIN:REQUEST-------\n"
- resulttxt += http.requestData
- resulttxt += "\n--------END:REQUEST--------\n"
</del><ins>+ requesttxt = "\n-------BEGIN:REQUEST-------\n"
+ requesttxt += http.requestData
+ requesttxt += "\n--------END:REQUEST--------\n"
+ self.manager.message("protocol", requesttxt)
</ins><span class="cx">
</span><span class="cx"> if req.print_response or (self.manager.print_request_response_on_error and not result):
</span><del>- resulttxt += "\n-------BEGIN:RESPONSE-------\n"
- resulttxt += "%s %s %s\n" % (getVersionStringFromResponse(response), response.status, response.reason,)
- resulttxt += str(response.msg) + "\n" + respdata
- resulttxt += "\n--------END:RESPONSE--------\n"
</del><ins>+ responsetxt = "\n-------BEGIN:RESPONSE-------\n"
+ responsetxt += "%s %s %s\n" % (getVersionStringFromResponse(response), response.status, response.reason,)
+ responsetxt += str(response.msg) + "\n" + respdata
+ responsetxt += "\n--------END:RESPONSE--------\n"
+ self.manager.message("protocol", responsetxt)
</ins><span class="cx">
</span><span class="cx"> if etags is not None and req.method == "GET":
</span><span class="cx"> hdrs = response.msg.getheaders("Etag")
</span></span></pre></div>
<a id="CalDAVTestertrunksrcobserversbasepy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/src/observers/base.py (15662 => 15663)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/src/observers/base.py        2016-06-09 20:52:09 UTC (rev 15662)
+++ CalDAVTester/trunk/src/observers/base.py        2016-06-09 21:06:10 UTC (rev 15663)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> testFile - add a test file
</span><span class="cx"> testSuite - add a test suite
</span><span class="cx"> testResult - add a test result
</span><ins>+ protocol - protocol log
</ins><span class="cx"> finish - tests completed
</span><span class="cx"> """
</span><span class="cx">
</span></span></pre></div>
<a id="CalDAVTestertrunksrcobserverslogpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/src/observers/log.py (15662 => 15663)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/src/observers/log.py        2016-06-09 20:52:09 UTC (rev 15662)
+++ CalDAVTester/trunk/src/observers/log.py        2016-06-09 21:06:10 UTC (rev 15663)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> self.loggedFailures = []
</span><span class="cx"> self.currentFile = None
</span><span class="cx"> self.currentSuite = None
</span><ins>+ self.currentProtocol = []
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> def updateCalls(self):
</span><span class="lines">@@ -46,6 +47,7 @@
</span><span class="cx"> "testFile": self.testFile,
</span><span class="cx"> "testSuite": self.testSuite,
</span><span class="cx"> "testResult": self.testResult,
</span><ins>+ "protocol": self.protocol,
</ins><span class="cx"> "finish": self.finish,
</span><span class="cx"> })
</span><span class="cx">
</span><span class="lines">@@ -101,7 +103,11 @@
</span><span class="cx"> )
</span><span class="cx"> self.loggedFailures.append(failtxt)
</span><span class="cx">
</span><ins>+ if self.currentProtocol:
+ self.manager.logit("\n".join(self.currentProtocol))
+ self.currentProtocol = []
</ins><span class="cx">
</span><ins>+
</ins><span class="cx"> def _logResult(self, name, result):
</span><span class="cx"> if result["result"] is not None:
</span><span class="cx"> result_value = self.RESULT_STRINGS[result["result"]]
</span><span class="lines">@@ -112,6 +118,10 @@
</span><span class="cx"> self.manager.logit(result["details"])
</span><span class="cx">
</span><span class="cx">
</span><ins>+ def protocol(self, result):
+ self.currentProtocol.append(result)
+
+
</ins><span class="cx"> def finish(self):
</span><span class="cx"> self.manager.logit("")
</span><span class="cx"> if self.manager.totals[manager.RESULT_FAILED] + self.manager.totals[manager.RESULT_ERROR] != 0:
</span></span></pre></div>
<a id="CalDAVTestertrunkverifiersjsonPointerMatchpy"></a>
<div class="modfile"><h4>Modified: CalDAVTester/trunk/verifiers/jsonPointerMatch.py (15662 => 15663)</h4>
<pre class="diff"><span>
<span class="info">--- CalDAVTester/trunk/verifiers/jsonPointerMatch.py        2016-06-09 20:52:09 UTC (rev 15662)
+++ CalDAVTester/trunk/verifiers/jsonPointerMatch.py        2016-06-09 21:06:10 UTC (rev 15663)
</span><span class="lines">@@ -29,6 +29,13 @@
</span><span class="cx">
</span><span class="cx"> class Verifier(object):
</span><span class="cx">
</span><ins>+ class JsonNull(object):
+ pass
+
+
+ null = JsonNull()
+
+
</ins><span class="cx"> def verify(self, manager, uri, response, respdata, args): #@UnusedVariable
</span><span class="cx"> # Get arguments
</span><span class="cx"> statusCodes = args.get("status", ["200", ])
</span><span class="lines">@@ -65,6 +72,8 @@
</span><span class="cx"> for jpath in exists:
</span><span class="cx"> if jpath.find("~$") != -1:
</span><span class="cx"> path, value = jpath.split("~$")
</span><ins>+ elif jpath.find("~~") != -1:
+ path, value = jpath.split("~~")[0], self.null
</ins><span class="cx"> else:
</span><span class="cx"> path, value = jpath, None
</span><span class="cx"> try:
</span><span class="lines">@@ -78,7 +87,7 @@
</span><span class="cx"> if not jobjs:
</span><span class="cx"> result = False
</span><span class="cx"> resulttxt += " Items not returned in JSON for %s\n" % (path,)
</span><del>- if value and value not in map(str, jobjs):
</del><ins>+ if value and value not in map(lambda x: self.null if x is None else str(x), jobjs):
</ins><span class="cx"> result = False
</span><span class="cx"> resulttxt += " Item values not returned in JSON for %s\n" % (jpath,)
</span><span class="cx"> except JSONPointerMatchError:
</span></span></pre>
</div>
</div>
</body>
</html>