100% test coverage for pathoc.py

This commit is contained in:
Aldo Cortesi 2012-07-23 17:42:44 +12:00
parent c1f75dd5a3
commit 1d1098687c
2 changed files with 12 additions and 1 deletions

View File

@ -54,7 +54,7 @@ various other goodies. Try it by visiting the server root:</p>
<pre class="example">200"YAY"</pre> <pre class="example">200"YAY"</pre>
<p>The quoted string here is an example of a <a href=#valuespec>Value <p>The quoted string here is an example of a <a href=/docs/language#valuespec>Value
Specifier</a>, a syntax that is used throughout the pathod response Specifier</a>, a syntax that is used throughout the pathod response
specification language. In this case, the quotes mean we're specifying a specification language. In this case, the quotes mean we're specifying a
literal string, but there are many other fun things we can do. For example, we literal string, but there are many other fun things we can do. For example, we

View File

@ -24,6 +24,17 @@ class TestDaemon:
_, _, _, _, content = c.request("get:/api/info") _, _, _, _, content = c.request("get:/api/info")
assert tuple(json.loads(content)["version"]) == version.IVERSION assert tuple(json.loads(content)["version"]) == version.IVERSION
def test_timeout(self):
c = pathoc.Pathoc("127.0.0.1", self.d.port)
c.connect()
c.settimeout(0.01)
s = cStringIO.StringIO()
c.print_requests(
["get:'/p/200:p10,0'"], True, True, s
)
assert "Timeout" in s.getvalue()
def tval(self, requests, verbose=False): def tval(self, requests, verbose=False):
c = pathoc.Pathoc("127.0.0.1", self.d.port) c = pathoc.Pathoc("127.0.0.1", self.d.port)
c.connect() c.connect()