diff options
| author | Aldo Cortesi <aldo@corte.si> | 2017-03-20 12:39:49 +1300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-20 12:39:49 +1300 |
| commit | 0c0c0d38cc65b4b1cecbe82d8d2b558ed3c62994 (patch) | |
| tree | d49c3621a0b80e4423e054e127a4d08d5d2a7ae1 /test | |
| parent | 92e33589159ee94df831fc0f0b2084854a6c44ae (diff) | |
| parent | b98ce71770d22d4b80e83f56b74dc710405cf535 (diff) | |
| download | mitmproxy-0c0c0d38cc65b4b1cecbe82d8d2b558ed3c62994.tar.gz mitmproxy-0c0c0d38cc65b4b1cecbe82d8d2b558ed3c62994.tar.bz2 mitmproxy-0c0c0d38cc65b4b1cecbe82d8d2b558ed3c62994.zip | |
Merge pull request #2186 from cortesi/tighten
Tighten some options-related functionality
Diffstat (limited to 'test')
| -rw-r--r-- | test/mitmproxy/addons/test_dumper.py | 6 | ||||
| -rw-r--r-- | test/mitmproxy/addons/test_streamfile.py | 8 | ||||
| -rw-r--r-- | test/mitmproxy/addons/test_view.py | 8 | ||||
| -rw-r--r-- | test/mitmproxy/test_optmanager.py | 8 | ||||
| -rw-r--r-- | test/mitmproxy/tools/test_dump.py | 2 |
5 files changed, 18 insertions, 14 deletions
diff --git a/test/mitmproxy/addons/test_dumper.py b/test/mitmproxy/addons/test_dumper.py index fbcc4d16..d2cefe79 100644 --- a/test/mitmproxy/addons/test_dumper.py +++ b/test/mitmproxy/addons/test_dumper.py @@ -16,7 +16,7 @@ from mitmproxy import options def test_configure(): d = dumper.Dumper() with taddons.context(options=options.Options()) as ctx: - ctx.configure(d, filtstr="~b foo") + ctx.configure(d, view_filter="~b foo") assert d.filter f = tflow.tflow(resp=True) @@ -24,10 +24,10 @@ def test_configure(): f.response.content = b"foo" assert d.match(f) - ctx.configure(d, filtstr=None) + ctx.configure(d, view_filter=None) assert not d.filter with pytest.raises(exceptions.OptionsError): - ctx.configure(d, filtstr="~~") + ctx.configure(d, view_filter="~~") assert not d.filter diff --git a/test/mitmproxy/addons/test_streamfile.py b/test/mitmproxy/addons/test_streamfile.py index 3f78521c..bcb27c79 100644 --- a/test/mitmproxy/addons/test_streamfile.py +++ b/test/mitmproxy/addons/test_streamfile.py @@ -15,10 +15,12 @@ def test_configure(tmpdir): with pytest.raises(exceptions.OptionsError): tctx.configure(sa, streamfile=str(tmpdir)) with pytest.raises(Exception, match="Invalid filter"): - tctx.configure(sa, streamfile=str(tmpdir.join("foo")), filtstr="~~") - tctx.configure(sa, filtstr="foo") + tctx.configure( + sa, streamfile=str(tmpdir.join("foo")), streamfile_filter="~~" + ) + tctx.configure(sa, streamfile_filter="foo") assert sa.filt - tctx.configure(sa, filtstr=None) + tctx.configure(sa, streamfile_filter=None) assert not sa.filt diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py index b7842314..7fa3819e 100644 --- a/test/mitmproxy/addons/test_view.py +++ b/test/mitmproxy/addons/test_view.py @@ -264,7 +264,7 @@ def test_signals(): def test_focus_follow(): v = view.View() with taddons.context(options=options.Options()) as tctx: - tctx.configure(v, console_focus_follow=True, filter="~m get") + tctx.configure(v, console_focus_follow=True, view_filter="~m get") v.add(tft(start=5)) assert v.focus.index == 0 @@ -378,9 +378,9 @@ def test_settings(): def test_configure(): v = view.View() with taddons.context(options=options.Options()) as tctx: - tctx.configure(v, filter="~q") + tctx.configure(v, view_filter="~q") with pytest.raises(Exception, match="Invalid interception filter"): - tctx.configure(v, filter="~~") + tctx.configure(v, view_filter="~~") tctx.configure(v, console_order="method") with pytest.raises(Exception, match="Unknown flow order"): @@ -388,7 +388,5 @@ def test_configure(): tctx.configure(v, console_order_reversed=True) - tctx.configure(v, console_order=None) - tctx.configure(v, console_focus_follow=True) assert v.focus_follow diff --git a/test/mitmproxy/test_optmanager.py b/test/mitmproxy/test_optmanager.py index ef5ebd27..01636640 100644 --- a/test/mitmproxy/test_optmanager.py +++ b/test/mitmproxy/test_optmanager.py @@ -210,8 +210,12 @@ def test_rollback(): o.errored.connect(errsub) assert o.one is None - o.one = 10 - o.bool = True + with pytest.raises(exceptions.OptionsError): + o.one = 10 + assert o.one is None + with pytest.raises(exceptions.OptionsError): + o.bool = True + assert o.bool is False assert isinstance(recerr[0]["exc"], exceptions.OptionsError) assert o.one is None assert o.bool is False diff --git a/test/mitmproxy/tools/test_dump.py b/test/mitmproxy/tools/test_dump.py index 8e2fa5b2..69a76d2e 100644 --- a/test/mitmproxy/tools/test_dump.py +++ b/test/mitmproxy/tools/test_dump.py @@ -12,7 +12,7 @@ from .. import tservers class TestDumpMaster(tservers.MasterTest): def mkmaster(self, flt, **opts): - o = options.Options(filtstr=flt, verbosity=-1, flow_detail=0, **opts) + o = options.Options(view_filter=flt, verbosity=-1, flow_detail=0, **opts) m = dump.DumpMaster(o, proxy.DummyServer(), with_termlog=False, with_dumper=False) return m |
