aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_flow.py5
-rw-r--r--test/netlib/test_utils.py11
-rw-r--r--test/pathod/test_language_base.py2
-rw-r--r--test/pathod/test_utils.py13
4 files changed, 16 insertions, 15 deletions
diff --git a/test/mitmproxy/test_flow.py b/test/mitmproxy/test_flow.py
index 62f23ac8..da8b8ddd 100644
--- a/test/mitmproxy/test_flow.py
+++ b/test/mitmproxy/test_flow.py
@@ -470,10 +470,7 @@ class TestFlow(object):
fm = flow.FlowMaster(None, s)
f = tutils.tflow()
- fm.handle_request(f)
-
- f = tutils.tflow()
- fm.handle_request(f)
+ f.intercept(fm)
s.killall(fm)
for i in s.view:
diff --git a/test/netlib/test_utils.py b/test/netlib/test_utils.py
index 1d8f7b0f..fce1d0a7 100644
--- a/test/netlib/test_utils.py
+++ b/test/netlib/test_utils.py
@@ -178,10 +178,15 @@ def test_bytes_to_escaped_str():
assert utils.bytes_to_escaped_str(b"\b") == r"\x08"
assert utils.bytes_to_escaped_str(br"&!?=\)") == r"&!?=\\)"
assert utils.bytes_to_escaped_str(b'\xc3\xbc') == r"\xc3\xbc"
+ assert utils.bytes_to_escaped_str(b"'") == r"\'"
+ assert utils.bytes_to_escaped_str(b'"') == r'"'
def test_escaped_str_to_bytes():
assert utils.escaped_str_to_bytes("foo") == b"foo"
- assert utils.escaped_str_to_bytes(r"\x08") == b"\b"
- assert utils.escaped_str_to_bytes(r"&!?=\\)") == br"&!?=\)"
- assert utils.escaped_str_to_bytes(r"ü") == b'\xc3\xbc'
+ assert utils.escaped_str_to_bytes("\x08") == b"\b"
+ assert utils.escaped_str_to_bytes("&!?=\\\\)") == br"&!?=\)"
+ assert utils.escaped_str_to_bytes("ü") == b'\xc3\xbc'
+ assert utils.escaped_str_to_bytes(u"\\x08") == b"\b"
+ assert utils.escaped_str_to_bytes(u"&!?=\\\\)") == br"&!?=\)"
+ assert utils.escaped_str_to_bytes(u"ü") == b'\xc3\xbc' \ No newline at end of file
diff --git a/test/pathod/test_language_base.py b/test/pathod/test_language_base.py
index 64d4af1f..2e5d9041 100644
--- a/test/pathod/test_language_base.py
+++ b/test/pathod/test_language_base.py
@@ -67,7 +67,7 @@ class TestTokValueLiteral:
def test_roundtrip(self):
self.roundtrip("'")
- self.roundtrip('\'')
+ self.roundtrip(r"\'")
self.roundtrip("a")
self.roundtrip("\"")
# self.roundtrip("\\")
diff --git a/test/pathod/test_utils.py b/test/pathod/test_utils.py
index 4dcedf6e..8026a576 100644
--- a/test/pathod/test_utils.py
+++ b/test/pathod/test_utils.py
@@ -1,6 +1,8 @@
from pathod import utils
import tutils
+import six
+
def test_membool():
m = utils.MemBool()
@@ -27,13 +29,10 @@ def test_data_path():
tutils.raises(ValueError, utils.data.path, "nonexistent")
-def test_inner_repr():
- assert utils.inner_repr("\x66") == "\x66"
- assert utils.inner_repr(u"foo") == "foo"
-
-
def test_escape_unprintables():
- s = "".join([chr(i) for i in range(255)])
+ s = bytes(range(256))
+ if six.PY2:
+ s = "".join([chr(i) for i in range(255)])
e = utils.escape_unprintables(s)
assert e.encode('ascii')
- assert not "PATHOD_MARKER" in e
+ assert "PATHOD_MARKER" not in e