From 96df077d5485979af256fe7b95708ace658fb8e2 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Mon, 7 Mar 2016 09:12:36 +0530 Subject: Add tests for add_header example --- test/mitmproxy/test_examples.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py index 16607a1b..8b6e0eab 100644 --- a/test/mitmproxy/test_examples.py +++ b/test/mitmproxy/test_examples.py @@ -7,6 +7,7 @@ from netlib.http import Headers from . import tservers, tutils from examples import ( + add_header, modify_form, ) @@ -38,6 +39,12 @@ def test_load_scripts(): s.unload() +def test_add_header(): + flow = tutils.tflow(resp=netutils.tresp()) + add_header.response({}, flow) + assert flow.response.headers["newheader"] == "foo" + + def test_modify_form(): form_header = Headers(content_type="application/x-www-form-urlencoded") flow = tutils.tflow(req=netutils.treq(headers=form_header)) -- cgit v1.2.3