diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/addons/test_script.py | 17 | ||||
-rw-r--r-- | test/mitmproxy/test_addonmanager.py | 8 | ||||
-rw-r--r-- | test/mitmproxy/tservers.py | 1 |
3 files changed, 5 insertions, 21 deletions
diff --git a/test/mitmproxy/addons/test_script.py b/test/mitmproxy/addons/test_script.py index 91637489..62762809 100644 --- a/test/mitmproxy/addons/test_script.py +++ b/test/mitmproxy/addons/test_script.py @@ -251,20 +251,6 @@ class TestScriptLoader: assert not tctx.options.scripts assert not sl.addons - def test_load_err(self, tdata): - sc = script.ScriptLoader() - with taddons.context(sc, loadcore=False) as tctx: - tctx.configure(sc, scripts=[ - tdata.path("mitmproxy/data/addonscripts/load_error.py") - ]) - try: - tctx.invoke(sc, "tick") - except ValueError: - pass # this is expected and normally guarded. - # on the next tick we should not fail however. - tctx.invoke(sc, "tick") - assert len(tctx.master.addons) == 1 - @pytest.mark.asyncio async def test_script_error_handler(self): path = "/sample/path/example.py" @@ -292,8 +278,7 @@ class TestScriptLoader: "%s/c.py" % rec, ] ) - tctx.master.addons.invoke_addon(sc, "tick") - await tctx.master.await_log("c tick") + await tctx.master.await_log("configure") debug = [i.msg for i in tctx.master.logs if i.level == "debug"] assert debug == [ 'a load', diff --git a/test/mitmproxy/test_addonmanager.py b/test/mitmproxy/test_addonmanager.py index 1ef1521d..02c8f2e2 100644 --- a/test/mitmproxy/test_addonmanager.py +++ b/test/mitmproxy/test_addonmanager.py @@ -15,7 +15,7 @@ from mitmproxy.test import tflow class TAddon: def __init__(self, name, addons=None): self.name = name - self.tick = True + self.response = True self.custom_called = False if addons: self.addons = addons @@ -127,12 +127,12 @@ async def test_simple(): a.add(TAddon("one")) a.trigger("running") - a.trigger("tick") + a.trigger("response") assert await tctx.master.await_log("not callable") tctx.master.clear() - a.get("one").tick = addons - a.trigger("tick") + a.get("one").response = addons + a.trigger("response") assert not await tctx.master.await_log("not callable") a.remove(a.get("one")) diff --git a/test/mitmproxy/tservers.py b/test/mitmproxy/tservers.py index 857ca45d..6f528ec2 100644 --- a/test/mitmproxy/tservers.py +++ b/test/mitmproxy/tservers.py @@ -117,7 +117,6 @@ class ProxyThread(threading.Thread): def set_addons(self, *addons): self.tmaster.reset(addons) - self.tmaster.addons.trigger("tick") def start(self): super().start() |