aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_rparse.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-07-23 14:37:00 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-07-23 14:37:00 +1200
commitc7b5faf7dbaab518bbe9942f018861f738ebb2b0 (patch)
tree3bdc5c6f10cc55e768936e1e7421b7e08074f6b4 /test/test_rparse.py
parent204a556aa7dbfd37daeb6605318ebc4b7ae8c6b1 (diff)
downloadmitmproxy-c7b5faf7dbaab518bbe9942f018861f738ebb2b0.tar.gz
mitmproxy-c7b5faf7dbaab518bbe9942f018861f738ebb2b0.tar.bz2
mitmproxy-c7b5faf7dbaab518bbe9942f018861f738ebb2b0.zip
Add hooks for policy checks of served data.
Diffstat (limited to 'test/test_rparse.py')
-rw-r--r--test/test_rparse.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_rparse.py b/test/test_rparse.py
index 0cb3e373..929d7342 100644
--- a/test/test_rparse.py
+++ b/test/test_rparse.py
@@ -419,6 +419,13 @@ class TestResponse:
assert r.body[:]
assert str(r)
+ def test_checkfunc(self):
+ s = cStringIO.StringIO()
+ r = rparse.parse_response({}, "400:b@100k")
+ def check(req, acts):
+ return "errmsg"
+ assert r.serve(s, check=check)["error"] == "errmsg"
+
def test_render(self):
s = cStringIO.StringIO()
r = rparse.parse_response({}, "400'msg'")