From 7209a75201a25d7ec2448c6ad1a871c0c403c97e Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Thu, 27 Sep 2012 09:44:25 +1200 Subject: Add pathoc -c to specify a list of return codes to ignore. --- test/test_pathoc.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test/test_pathoc.py') diff --git a/test/test_pathoc.py b/test/test_pathoc.py index 0a37c4b7..e9690dd5 100644 --- a/test/test_pathoc.py +++ b/test/test_pathoc.py @@ -24,7 +24,7 @@ class TestDaemon: _, _, _, _, content = c.request("get:/api/info") assert tuple(json.loads(content)["version"]) == version.IVERSION - def tval(self, requests, showreq=False, showresp=False, explain=False, hexdump=False, timeout=None): + def tval(self, requests, showreq=False, showresp=False, explain=False, hexdump=False, timeout=None, ignorecodes=None): c = pathoc.Pathoc("127.0.0.1", self.d.port) c.connect() if timeout: @@ -37,10 +37,17 @@ class TestDaemon: showresp = showresp, explain = explain, hexdump = hexdump, + ignorecodes = ignorecodes, fp = s ) return s.getvalue() + def test_ignorecodes(self): + assert "200" in self.tval(["get:'/p/200:b@1'"]) + assert "200" not in self.tval(["get:'/p/200:b@1'"], ignorecodes=[200]) + assert "200" not in self.tval(["get:'/p/200:b@1'"], ignorecodes=[200, 201]) + assert "202" in self.tval(["get:'/p/202:b@1'"], ignorecodes=[200, 201]) + def test_timeout(self): assert "Timeout" in self.tval(["get:'/p/200:p0,10'"], timeout=0.01) assert "HTTP" in self.tval(["get:'/p/200:p5,10'"], showresp=True, timeout=0.01) -- cgit v1.2.3