From 1d1098687cd397966cf810b52cbf9fe1bc8b1ec4 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 23 Jul 2012 17:42:44 +1200 Subject: [PATCH] 100% test coverage for pathoc.py --- libpathod/templates/docs_pathod.html | 2 +- test/test_pathoc.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libpathod/templates/docs_pathod.html b/libpathod/templates/docs_pathod.html index 968665799..977642c68 100644 --- a/libpathod/templates/docs_pathod.html +++ b/libpathod/templates/docs_pathod.html @@ -54,7 +54,7 @@ various other goodies. Try it by visiting the server root:

200"YAY"
-

The quoted string here is an example of a Value +

The quoted string here is an example of a Value Specifier, a syntax that is used throughout the pathod response 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 diff --git a/test/test_pathoc.py b/test/test_pathoc.py index 784e2ee32..15493e965 100644 --- a/test/test_pathoc.py +++ b/test/test_pathoc.py @@ -24,6 +24,17 @@ class TestDaemon: _, _, _, _, content = c.request("get:/api/info") 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): c = pathoc.Pathoc("127.0.0.1", self.d.port) c.connect()