aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_examples.py10
-rw-r--r--test/netlib/test_strutils.py15
2 files changed, 9 insertions, 16 deletions
diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py
index 607d6faf..22d3c425 100644
--- a/test/mitmproxy/test_examples.py
+++ b/test/mitmproxy/test_examples.py
@@ -73,9 +73,9 @@ def test_add_header():
def test_custom_contentviews():
with example("custom_contentviews.py") as ex:
pig = ex.ctx.contentview
- _, fmt = pig("<html>test!</html>")
- assert any('esttay!' in val[0][1] for val in fmt)
- assert not pig("gobbledygook")
+ _, fmt = pig(b"<html>test!</html>")
+ assert any(b'esttay!' in val[0][1] for val in fmt)
+ assert not pig(b"gobbledygook")
def test_iframe_injector():
@@ -103,7 +103,7 @@ def test_modify_form():
def test_modify_querystring():
- flow = tutils.tflow(req=netutils.treq(path="/search?q=term"))
+ flow = tutils.tflow(req=netutils.treq(path=b"/search?q=term"))
with example("modify_querystring.py") as ex:
ex.run("request", flow)
assert flow.request.query["mitmproxy"] == "rocks"
@@ -126,7 +126,7 @@ def test_modify_response_body():
def test_redirect_requests():
- flow = tutils.tflow(req=netutils.treq(host="example.org"))
+ flow = tutils.tflow(req=netutils.treq(host=b"example.org"))
with example("redirect_requests.py") as ex:
ex.run("request", flow)
assert flow.request.host == "mitmproxy.org"
diff --git a/test/netlib/test_strutils.py b/test/netlib/test_strutils.py
index 33bce714..f88e33ed 100644
--- a/test/netlib/test_strutils.py
+++ b/test/netlib/test_strutils.py
@@ -68,17 +68,10 @@ def test_escaped_str_to_bytes():
strutils.escaped_str_to_bytes(b"very byte")
-def test_isBin():
- assert not strutils.isBin("testing\n\r")
- assert strutils.isBin("testing\x01")
- assert strutils.isBin("testing\x0e")
- assert strutils.isBin("testing\x7f")
-
-
-def test_isXml():
- assert not strutils.isXML("foo")
- assert strutils.isXML("<foo")
- assert strutils.isXML(" \n<foo")
+def test_is_xml():
+ assert not strutils.is_xml(b"foo")
+ assert strutils.is_xml(b"<foo")
+ assert strutils.is_xml(b" \n<foo")
def test_clean_hanging_newline():