From 9a0195bf64e746d5932125122bd56ec150f928bf Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 16 Oct 2016 18:48:22 +1300 Subject: scripts: keep scripts just after the ScriptLoader in addon chain We need scripts to run _before_ filestreamer, so we can't just add them to the end of the chain. This patch also fixes an issue that could cause scripts to be initialised un-necessarily if only the order of scripts in options changed. --- test/mitmproxy/builtins/test_script.py | 8 ++------ test/mitmproxy/test_addons.py | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/mitmproxy/builtins/test_script.py b/test/mitmproxy/builtins/test_script.py index 261adb65..54451313 100644 --- a/test/mitmproxy/builtins/test_script.py +++ b/test/mitmproxy/builtins/test_script.py @@ -237,12 +237,8 @@ class TestScriptLoader(mastertest.MasterTest): "%s %s" % (rec, "b"), ] debug = [(i[0], i[1]) for i in m.event_log if i[0] == "debug"] - assert debug == [ - ('debug', 'c configure'), - ('debug', 'a configure'), - ('debug', 'b configure'), - ] - m.event_log[:] = [] + # No events, only order has changed + assert debug == [] o.scripts = [ "%s %s" % (rec, "x"), diff --git a/test/mitmproxy/test_addons.py b/test/mitmproxy/test_addons.py index 52d7f07f..c5d54e8c 100644 --- a/test/mitmproxy/test_addons.py +++ b/test/mitmproxy/test_addons.py @@ -16,6 +16,6 @@ def test_simple(): o = options.Options() m = controller.Master(o) a = addons.Addons(m) - a.add(o, TAddon("one")) + a.add(TAddon("one")) assert a.get("one") assert not a.get("two") -- cgit v1.2.3