aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-02-18 11:27:40 +0100
committerMaximilian Hils <git@maximilianhils.com>2016-02-18 11:27:40 +0100
commitbf024cd15320119e341cdf9bf0fd4d69df233c64 (patch)
tree05a6338d94c665421ae1eab07f14aed61b8bd2b1 /test
parentf42af9061220ec0373e94e96b69434575f60281d (diff)
parent31ab3a231e540815009ffe5aeae108db2babd8a9 (diff)
downloadmitmproxy-bf024cd15320119e341cdf9bf0fd4d69df233c64.tar.gz
mitmproxy-bf024cd15320119e341cdf9bf0fd4d69df233c64.tar.bz2
mitmproxy-bf024cd15320119e341cdf9bf0fd4d69df233c64.zip
Merge branch 'master' of https://github.com/mitmproxy/mitmproxy
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/fuzzing/.env10
-rw-r--r--test/mitmproxy/fuzzing/straight_stream_patterns1
-rw-r--r--test/mitmproxy/test_contentview.py21
-rw-r--r--test/mitmproxy/test_examples.py2
4 files changed, 26 insertions, 8 deletions
diff --git a/test/mitmproxy/fuzzing/.env b/test/mitmproxy/fuzzing/.env
index 82ae6a8d..8923b8ae 100644
--- a/test/mitmproxy/fuzzing/.env
+++ b/test/mitmproxy/fuzzing/.env
@@ -1,6 +1,4 @@
-
-MITMDUMP=../../mitmdump
-PATHOD=../../../pathod/pathod
-PATHOC=../../../pathod/pathoc
-FUZZ_SETTINGS=-remTt 1 -n 0
-
+MITMDUMP=mitmdump
+PATHOD=pathod
+PATHOC=pathoc
+FUZZ_SETTINGS="-remTt 1 -n 0"
diff --git a/test/mitmproxy/fuzzing/straight_stream_patterns b/test/mitmproxy/fuzzing/straight_stream_patterns
index 93a066e6..235f2cc3 100644
--- a/test/mitmproxy/fuzzing/straight_stream_patterns
+++ b/test/mitmproxy/fuzzing/straight_stream_patterns
@@ -9,7 +9,6 @@ get:'http://localhost:9999/p/':s'200:b"foo":ir,"\n"'
get:'http://localhost:9999/p/':s'200:b"foo":ir,"a"'
get:'http://localhost:9999/p/':s'200:b"foo":ir,"9"'
get:'http://localhost:9999/p/':s'200:b"foo":ir,":"'
-get:'http://localhost:9999/p/':s"200:b'foo':ir,'\"'"
get:'http://localhost:9999/p/':s'200:b"foo":ir,"-"'
get:'http://localhost:9999/p/':s'200:b"foo":dr'
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"),
diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py
index 6920c8e9..54e6e753 100644
--- a/test/mitmproxy/test_examples.py
+++ b/test/mitmproxy/test_examples.py
@@ -5,7 +5,7 @@ from . import tservers
def test_load_scripts():
- example_dir = utils.Data("mitmproxy").path("../examples")
+ example_dir = utils.Data("mitmproxy").path("../../examples")
scripts = glob.glob("%s/*.py" % example_dir)
tmaster = tservers.TestMaster(config.ProxyConfig())