aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRajat Gupta <35985127+rjt-gupta@users.noreply.github.com>2018-12-04 02:35:59 +0530
committerMaximilian Hils <git@maximilianhils.com>2018-12-03 22:05:59 +0100
commitdb658b12edf9a44e40ca79209a652e839ffa78dd (patch)
tree5b7147e54ee358aa442e0bb5bcd5db34abc2ca89 /test
parentce28721458c8cc71de86513a5110676e9763041b (diff)
downloadmitmproxy-db658b12edf9a44e40ca79209a652e839ffa78dd.tar.gz
mitmproxy-db658b12edf9a44e40ca79209a652e839ffa78dd.tar.bz2
mitmproxy-db658b12edf9a44e40ca79209a652e839ffa78dd.zip
fix query array
fixes #3072 closes #3254
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/contentviews/test_base.py15
-rw-r--r--test/mitmproxy/contentviews/test_query.py4
2 files changed, 17 insertions, 2 deletions
diff --git a/test/mitmproxy/contentviews/test_base.py b/test/mitmproxy/contentviews/test_base.py
index c94d8be2..cd879bfd 100644
--- a/test/mitmproxy/contentviews/test_base.py
+++ b/test/mitmproxy/contentviews/test_base.py
@@ -15,3 +15,18 @@ def test_format_dict():
f_d = base.format_dict(d)
with pytest.raises(StopIteration):
next(f_d)
+
+
+def test_format_pairs():
+ d = [("a", "c"), ("b", "d")]
+ f_d = base.format_pairs(d)
+ assert next(f_d)
+
+ d = [("abc", "")]
+ f_d = base.format_pairs(d)
+ assert next(f_d)
+
+ d = []
+ f_d = base.format_pairs(d)
+ with pytest.raises(StopIteration):
+ next(f_d)
diff --git a/test/mitmproxy/contentviews/test_query.py b/test/mitmproxy/contentviews/test_query.py
index 741b23f1..1ae1b3ac 100644
--- a/test/mitmproxy/contentviews/test_query.py
+++ b/test/mitmproxy/contentviews/test_query.py
@@ -6,8 +6,8 @@ from . import full_eval
def test_view_query():
d = ""
v = full_eval(query.ViewQuery())
- f = v(d, query=multidict.MultiDict([("foo", "bar")]))
+ f = v(d, query=multidict.MultiDict([("foo", "bar"), ("foo", "baz")]))
assert f[0] == "Query"
- assert f[1] == [[("header", "foo: "), ("text", "bar")]]
+ assert f[1] == [[("header", "foo: "), ("text", "bar")], [("header", "foo: "), ("text", "baz")]]
assert v(d) == ("Query", [])