aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-02-18 09:05:54 +1300
committerAldo Cortesi <aldo@nullcube.com>2016-02-18 09:05:54 +1300
commit49464de1cb159361c16a232b3d8c267b36e95483 (patch)
tree35ae03999fad195744a81f5191babe9fea29e1fc /test
parent10047a025fd80f0bbf7970141bf344166058f2b6 (diff)
parent10eed53d0a28acc40b594fee6779c4fbaf5acff9 (diff)
downloadmitmproxy-49464de1cb159361c16a232b3d8c267b36e95483.tar.gz
mitmproxy-49464de1cb159361c16a232b3d8c267b36e95483.tar.bz2
mitmproxy-49464de1cb159361c16a232b3d8c267b36e95483.zip
Merge branch 'master' of ssh.github.com:mitmproxy/mitmproxy
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_contentview.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/mitmproxy/test_contentview.py b/test/mitmproxy/test_contentview.py
index 7f1d735e..c00afa5f 100644
--- a/test/mitmproxy/test_contentview.py
+++ b/test/mitmproxy/test_contentview.py
@@ -1,5 +1,6 @@
from mitmproxy.exceptions import ContentViewException
from netlib.http import Headers
+from netlib.odict import ODict
import netlib.utils
from netlib import encoding
@@ -45,6 +46,19 @@ class TestContentView:
)
assert f[0].startswith("XML")
+ f = v(
+ "",
+ headers=Headers()
+ )
+ assert f[0] == "No content"
+
+ f = v(
+ "",
+ headers=Headers(),
+ query=ODict([("foo", "bar")]),
+ )
+ assert f[0] == "Query"
+
def test_view_urlencoded(self):
d = netlib.utils.urlencode([("one", "two"), ("three", "four")])
v = cv.ViewURLEncoded()
@@ -158,6 +172,13 @@ Larry
h = Headers(content_type="unparseable")
assert not view(v, headers=h)
+ def test_view_query(self):
+ d = ""
+ v = cv.ViewQuery()
+ f = v(d, query=ODict([("foo", "bar")]))
+ assert f[0] == "Query"
+ assert [x for x in f[1]] == [[("header", "foo: "), ("text", "bar")]]
+
def test_get_content_view(self):
r = cv.get_content_view(
cv.get("Raw"),