aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_readfile.py4
-rw-r--r--test/mitmproxy/net/http/test_headers.py2
-rw-r--r--test/mitmproxy/test_http.py4
3 files changed, 5 insertions, 5 deletions
diff --git a/test/mitmproxy/addons/test_readfile.py b/test/mitmproxy/addons/test_readfile.py
index 3d28d8b7..94e18cdb 100644
--- a/test/mitmproxy/addons/test_readfile.py
+++ b/test/mitmproxy/addons/test_readfile.py
@@ -30,8 +30,8 @@ def data():
@pytest.fixture
-def corrupt_data():
- f = data()
+def corrupt_data(data):
+ f = io.BytesIO(data.getvalue())
f.seek(0, io.SEEK_END)
f.write(b"qibble")
f.seek(0)
diff --git a/test/mitmproxy/net/http/test_headers.py b/test/mitmproxy/net/http/test_headers.py
index e8eb31d3..8fc8b027 100644
--- a/test/mitmproxy/net/http/test_headers.py
+++ b/test/mitmproxy/net/http/test_headers.py
@@ -75,7 +75,7 @@ class TestHeaders:
def test_replace_multi(self):
headers = self._2host()
- headers.replace(r"Host: example\.com", r"Host: example.de")
+ headers.replace(r"Host: example.com", r"Host: example.de")
assert headers.get_all("Host") == ["example.de", "example.org"]
def test_replace_remove_spacer(self):
diff --git a/test/mitmproxy/test_http.py b/test/mitmproxy/test_http.py
index 49e61e25..8a299d8e 100644
--- a/test/mitmproxy/test_http.py
+++ b/test/mitmproxy/test_http.py
@@ -49,7 +49,7 @@ class TestHTTPRequest:
r.path = "path/foo"
r.headers["Foo"] = "fOo"
r.content = b"afoob"
- assert r.replace("foo(?i)", "boo") == 4
+ assert r.replace("(?i)foo", "boo") == 4
assert r.path == "path/boo"
assert b"foo" not in r.content
assert r.headers["boo"] == "boo"
@@ -82,7 +82,7 @@ class TestHTTPResponse:
r = http.HTTPResponse.wrap(mitmproxy.test.tutils.tresp())
r.headers["Foo"] = "fOo"
r.content = b"afoob"
- assert r.replace("foo(?i)", "boo") == 3
+ assert r.replace("(?i)foo", "boo") == 3
assert b"foo" not in r.content
assert r.headers["boo"] == "boo"