aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-09-26 10:12:30 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-09-26 10:12:30 +1200
commit0a5d4fbbbb06a4e6c5e6172b353aa878aaa6e0c6 (patch)
tree2e0d2614d6f77446c674a346f5d0d103a6e03528 /test
parent0dd250d4f886cfa7cf91e3690b4196acfe3740ce (diff)
downloadmitmproxy-0a5d4fbbbb06a4e6c5e6172b353aa878aaa6e0c6.tar.gz
mitmproxy-0a5d4fbbbb06a4e6c5e6172b353aa878aaa6e0c6.tar.bz2
mitmproxy-0a5d4fbbbb06a4e6c5e6172b353aa878aaa6e0c6.zip
Stub out new output argument structure.
Diffstat (limited to 'test')
-rw-r--r--test/test_pathoc.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/test/test_pathoc.py b/test/test_pathoc.py
index 397a7f0e..8eb180af 100644
--- a/test/test_pathoc.py
+++ b/test/test_pathoc.py
@@ -31,21 +31,28 @@ class TestDaemon:
s = cStringIO.StringIO()
c.print_requests(
- ["get:'/p/200:p0,10'"], True, True, s
+ ["get:'/p/200:p0,10'"], True, True, True, True, s
)
assert "Timeout" in s.getvalue()
- def tval(self, requests, verbose=False):
+ def tval(self, requests, showreq=False, showresp=False, explain=False, hexdump=False):
c = pathoc.Pathoc("127.0.0.1", self.d.port)
c.connect()
s = cStringIO.StringIO()
- c.print_requests(requests, verbose, True, s)
+ c.print_requests(
+ requests,
+ showreq = showreq,
+ showresp = showresp,
+ explain = explain,
+ hexdump = hexdump,
+ fp = s
+ )
return s.getvalue()
def test_print_requests(self):
reqs = [ "get:/api/info:p0,0", "get:/api/info:p0,0" ]
- assert self.tval(reqs, False).count("200") == 2
- assert self.tval(reqs, True).count("Date") == 2
+ assert self.tval(reqs).count("200") == 2
+ assert self.tval(reqs, showresp=True).count("Date") == 2
def test_parse_err(self):
assert "Error parsing" in self.tval(["foo"])
@@ -53,8 +60,12 @@ class TestDaemon:
def test_conn_err(self):
assert "Invalid server response" in self.tval(["get:'/p/200:d2'"])
+ def test_explain(self):
+ reqs = [ "get:/api/info:ir,'x'"]
+ assert "inject" in self.tval(reqs, explain=True)
+
def test_fileread(self):
d = tutils.test_data.path("data/request")
- assert "foo" in self.tval(["+%s"%d])
+ assert "foo" in self.tval(["+%s"%d], explain=True)
assert "File" in self.tval(["+/nonexistent"])