aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorShadab Zafar <dufferzafar0@gmail.com>2016-03-07 09:12:10 +0530
committerShadab Zafar <dufferzafar0@gmail.com>2016-03-11 17:57:57 +0530
commita2274f52e4567de4209e3394060fe62276ad3546 (patch)
tree3f9f73d454eb790b7b33d03329eeb73087ca2dce /test
parent106b296871676743b04c6418d5de596ae44c1648 (diff)
downloadmitmproxy-a2274f52e4567de4209e3394060fe62276ad3546.tar.gz
mitmproxy-a2274f52e4567de4209e3394060fe62276ad3546.tar.bz2
mitmproxy-a2274f52e4567de4209e3394060fe62276ad3546.zip
Add tests for modify_form example
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_examples.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py
index 163ace17..16607a1b 100644
--- a/test/mitmproxy/test_examples.py
+++ b/test/mitmproxy/test_examples.py
@@ -1,7 +1,15 @@
import glob
+
from mitmproxy import utils, script
from mitmproxy.proxy import config
-from . import tservers
+from netlib import tutils as netutils
+from netlib.http import Headers
+from . import tservers, tutils
+
+from examples import (
+ modify_form,
+
+)
def test_load_scripts():
@@ -28,3 +36,11 @@ def test_load_scripts():
raise
else:
s.unload()
+
+
+def test_modify_form():
+ form_header = Headers(content_type="application/x-www-form-urlencoded")
+ flow = tutils.tflow(req=netutils.treq(headers=form_header))
+ modify_form.request({}, flow)
+ assert flow.request.urlencoded_form["mitmproxy"] == ["rocks"]
+