aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_streamfile.py14
-rw-r--r--test/mitmproxy/test_dump.py28
2 files changed, 5 insertions, 37 deletions
diff --git a/test/mitmproxy/addons/test_streamfile.py b/test/mitmproxy/addons/test_streamfile.py
index f63f29c4..82a4345b 100644
--- a/test/mitmproxy/addons/test_streamfile.py
+++ b/test/mitmproxy/addons/test_streamfile.py
@@ -16,15 +16,11 @@ def test_configure():
p = os.path.join(tdir, "foo")
tutils.raises(
exceptions.OptionsError,
- tctx.configure, sa, streamfile=(tdir, "ab")
+ tctx.configure, sa, streamfile=tdir
)
tutils.raises(
"invalid filter",
- tctx.configure, sa, streamfile=(p, "ab"), filtstr="~~"
- )
- tutils.raises(
- "invalid mode",
- tctx.configure, sa, streamfile=(p, "xx")
+ tctx.configure, sa, streamfile=p, filtstr="~~"
)
@@ -38,7 +34,7 @@ def test_tcp():
with taddons.context() as tctx:
with tutils.tmpdir() as tdir:
p = os.path.join(tdir, "foo")
- tctx.configure(sa, streamfile=(p, "wb"))
+ tctx.configure(sa, streamfile=p)
tt = tflow.ttcpflow()
sa.tcp_start(tt)
@@ -53,7 +49,7 @@ def test_simple():
with tutils.tmpdir() as tdir:
p = os.path.join(tdir, "foo")
- tctx.configure(sa, streamfile=(p, "wb"))
+ tctx.configure(sa, streamfile=p)
f = tflow.tflow(resp=True)
sa.request(f)
@@ -61,7 +57,7 @@ def test_simple():
tctx.configure(sa, streamfile=None)
assert rd(p)[0].response
- tctx.configure(sa, streamfile=(p, "ab"))
+ tctx.configure(sa, streamfile=p, streamfile_append=True)
f = tflow.tflow()
sa.request(f)
tctx.configure(sa, streamfile=None)
diff --git a/test/mitmproxy/test_dump.py b/test/mitmproxy/test_dump.py
index aa3228e4..e331637d 100644
--- a/test/mitmproxy/test_dump.py
+++ b/test/mitmproxy/test_dump.py
@@ -2,7 +2,6 @@ from mitmproxy.test import tflow
import os
import io
-import mitmproxy.io
from mitmproxy.tools import dump
from mitmproxy import exceptions
from mitmproxy import proxy
@@ -126,33 +125,6 @@ class TestDumpMaster(mastertest.MasterTest):
f = self.cycle(m, b"content")
assert f.request.headers["one"] == "two"
- def test_write(self):
- with tutils.tmpdir() as d:
- p = os.path.join(d, "a")
- self.dummy_cycle(
- self.mkmaster(None, outfile=(p, "wb"), verbosity=0), 1, b""
- )
- assert len(list(mitmproxy.io.FlowReader(open(p, "rb")).stream())) == 1
-
- def test_write_append(self):
- with tutils.tmpdir() as d:
- p = os.path.join(d, "a.append")
- self.dummy_cycle(
- self.mkmaster(None, outfile=(p, "wb"), verbosity=0),
- 1, b""
- )
- self.dummy_cycle(
- self.mkmaster(None, outfile=(p, "ab"), verbosity=0),
- 1, b""
- )
- assert len(list(mitmproxy.io.FlowReader(open(p, "rb")).stream())) == 2
-
- def test_write_err(self):
- tutils.raises(
- exceptions.OptionsError,
- self.mkmaster, None, outfile = ("nonexistentdir/foo", "wb")
- )
-
def test_script(self):
ret = self.dummy_cycle(
self.mkmaster(