aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShadab Zafar <dufferzafar0@gmail.com>2016-03-07 09:41:17 +0530
committerShadab Zafar <dufferzafar0@gmail.com>2016-03-11 17:57:57 +0530
commitba1cf18f4255cf7e59ce51d48521852fb876dbd9 (patch)
tree5ecd0fe3a1c31cd2626e1980e83f8cf99bafd318
parent5eca2223d538752721ead11c63118df7689bb52d (diff)
downloadmitmproxy-ba1cf18f4255cf7e59ce51d48521852fb876dbd9.tar.gz
mitmproxy-ba1cf18f4255cf7e59ce51d48521852fb876dbd9.tar.bz2
mitmproxy-ba1cf18f4255cf7e59ce51d48521852fb876dbd9.zip
Add tests for custom_contentviews example
-rw-r--r--test/mitmproxy/test_examples.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py
index c7fa90c8..5d1a18ed 100644
--- a/test/mitmproxy/test_examples.py
+++ b/test/mitmproxy/test_examples.py
@@ -8,6 +8,7 @@ from . import tservers, tutils
from examples import (
add_header,
+ custom_contentviews,
modify_form,
modify_querystring,
modify_response_body,
@@ -72,4 +73,11 @@ def test_modify_response_body():
flow = tutils.tflow(resp=netutils.tresp(content="I <3 mitmproxy"))
modify_response_body.response(ctx, flow)
- assert flow.response.content == "I <3 rocks" \ No newline at end of file
+ assert flow.response.content == "I <3 rocks"
+
+
+def test_custom_contentviews():
+ pig = custom_contentviews.ViewPigLatin()
+ _, fmt = pig("<html>test!</html>")
+ assert any('esttay!' in val[0][1] for val in fmt)
+ assert not pig("gobbledygook")