aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2018-02-24 14:39:03 +1300
committerAldo Cortesi <aldo@nullcube.com>2018-02-24 14:39:03 +1300
commita12d1492308f281ae599f1142104eb62d924f3f1 (patch)
tree2e29af1df9cf47ffdb289b6a41de9aa92c1c5112 /test
parent42094b29ff5e042b3cf3c2544fc7a60555cd3c26 (diff)
downloadmitmproxy-a12d1492308f281ae599f1142104eb62d924f3f1.tar.gz
mitmproxy-a12d1492308f281ae599f1142104eb62d924f3f1.tar.bz2
mitmproxy-a12d1492308f281ae599f1142104eb62d924f3f1.zip
client options: migrate allowremote and clientplayback
Also triage options, and categorize them into core options (won't be migrated), options that are hard to migrate for various reasons, and easy migrations.
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_allowremote.py3
-rw-r--r--test/mitmproxy/addons/test_clientplayback.py6
2 files changed, 4 insertions, 5 deletions
diff --git a/test/mitmproxy/addons/test_allowremote.py b/test/mitmproxy/addons/test_allowremote.py
index 9fc71525..52dae68d 100644
--- a/test/mitmproxy/addons/test_allowremote.py
+++ b/test/mitmproxy/addons/test_allowremote.py
@@ -19,8 +19,7 @@ from mitmproxy.test import taddons
])
def test_allowremote(allow_remote, ip, should_be_killed):
ar = allowremote.AllowRemote()
- with taddons.context() as tctx:
- tctx.master.addons.register(ar)
+ with taddons.context(ar) as tctx:
tctx.options.allow_remote = allow_remote
with mock.patch('mitmproxy.proxy.protocol.base.Layer') as layer:
diff --git a/test/mitmproxy/addons/test_clientplayback.py b/test/mitmproxy/addons/test_clientplayback.py
index 3f990668..f172af83 100644
--- a/test/mitmproxy/addons/test_clientplayback.py
+++ b/test/mitmproxy/addons/test_clientplayback.py
@@ -24,7 +24,7 @@ class MockThread():
class TestClientPlayback:
def test_playback(self):
cp = clientplayback.ClientPlayback()
- with taddons.context() as tctx:
+ with taddons.context(cp) as tctx:
assert cp.count() == 0
f = tflow.tflow(resp=True)
cp.start_replay([f])
@@ -58,7 +58,7 @@ class TestClientPlayback:
def test_load_file(self, tmpdir):
cp = clientplayback.ClientPlayback()
- with taddons.context():
+ with taddons.context(cp):
fpath = str(tmpdir.join("flows"))
tdump(fpath, [tflow.tflow(resp=True)])
cp.load_file(fpath)
@@ -68,7 +68,7 @@ class TestClientPlayback:
def test_configure(self, tmpdir):
cp = clientplayback.ClientPlayback()
- with taddons.context() as tctx:
+ with taddons.context(cp) as tctx:
path = str(tmpdir.join("flows"))
tdump(path, [tflow.tflow()])
tctx.configure(cp, client_replay=[path])