aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-09-27 09:44:25 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-09-27 09:44:25 +1200
commit7209a75201a25d7ec2448c6ad1a871c0c403c97e (patch)
treeb5986b17db4c81e5501e1837f8a78fd76ca39018 /test
parent10a19fc4da5a6fbbfd4a36d0e61d3bc80a38e937 (diff)
downloadmitmproxy-7209a75201a25d7ec2448c6ad1a871c0c403c97e.tar.gz
mitmproxy-7209a75201a25d7ec2448c6ad1a871c0c403c97e.tar.bz2
mitmproxy-7209a75201a25d7ec2448c6ad1a871c0c403c97e.zip
Add pathoc -c to specify a list of return codes to ignore.
Diffstat (limited to 'test')
-rw-r--r--test/test_pathoc.py9
1 files changed, 8 insertions, 1 deletions
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)