From ba1cf18f4255cf7e59ce51d48521852fb876dbd9 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Mon, 7 Mar 2016 09:41:17 +0530 Subject: [PATCH] Add tests for custom_contentviews example --- test/mitmproxy/test_examples.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py index c7fa90c84..5d1a18ed7 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("test!") + assert any('esttay!' in val[0][1] for val in fmt) + assert not pig("gobbledygook")