aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2017-03-16 07:53:19 +1300
committerAldo Cortesi <aldo@corte.si>2017-03-16 08:50:29 +1300
commit169068c7ec97ae0dfb64cfa5e5b1588c6e62297d (patch)
treed33b3900b01c87c0fb13258ccde43e1c1238f57b /test
parentef582333ff432e11e696b95d7da456d8b6eae5cd (diff)
downloadmitmproxy-169068c7ec97ae0dfb64cfa5e5b1588c6e62297d.tar.gz
mitmproxy-169068c7ec97ae0dfb64cfa5e5b1588c6e62297d.tar.bz2
mitmproxy-169068c7ec97ae0dfb64cfa5e5b1588c6e62297d.zip
Clean up addonmanager interface
Clarify the plethora of invocation methods we've sprouted, correct some usages in the codebase.
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_addonmanager.py4
-rw-r--r--test/mitmproxy/test_examples.py8
-rw-r--r--test/mitmproxy/tservers.py2
3 files changed, 8 insertions, 6 deletions
diff --git a/test/mitmproxy/test_addonmanager.py b/test/mitmproxy/test_addonmanager.py
index 3e5f71c6..ef34371f 100644
--- a/test/mitmproxy/test_addonmanager.py
+++ b/test/mitmproxy/test_addonmanager.py
@@ -30,6 +30,6 @@ def test_simple():
assert not a.chain
a.add(TAddon("one"))
- a("done")
+ a.trigger("done")
with pytest.raises(exceptions.AddonError):
- a("tick")
+ a.trigger("tick")
diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py
index f20e0c8c..56692364 100644
--- a/test/mitmproxy/test_examples.py
+++ b/test/mitmproxy/test_examples.py
@@ -145,7 +145,7 @@ class TestHARDump:
path = str(tmpdir.join("somefile"))
m, sc = tscript("complex/har_dump.py", shlex.quote(path))
- m.addons.invoke(m, "response", self.flow())
+ m.addons.trigger("response", self.flow())
m.addons.remove(sc)
with open(path, "r") as inp:
@@ -156,7 +156,9 @@ class TestHARDump:
path = str(tmpdir.join("somefile"))
m, sc = tscript("complex/har_dump.py", shlex.quote(path))
- m.addons.invoke(m, "response", self.flow(resp_content=b"foo" + b"\xFF" * 10))
+ m.addons.trigger(
+ "response", self.flow(resp_content=b"foo" + b"\xFF" * 10)
+ )
m.addons.remove(sc)
with open(path, "r") as inp:
@@ -194,7 +196,7 @@ class TestHARDump:
path = str(tmpdir.join("somefile"))
m, sc = tscript("complex/har_dump.py", shlex.quote(path))
- m.addons.invoke(m, "response", f)
+ m.addons.trigger("response", f)
m.addons.remove(sc)
with open(path, "r") as inp:
diff --git a/test/mitmproxy/tservers.py b/test/mitmproxy/tservers.py
index c47411ee..0f34e37e 100644
--- a/test/mitmproxy/tservers.py
+++ b/test/mitmproxy/tservers.py
@@ -80,7 +80,7 @@ class TestMaster(master.Master):
self.addons.add(self.state)
self.addons.add(*addons)
self.addons.configure_all(self.options, self.options.keys())
- self.addons.invoke_all_with_context("running")
+ self.addons.trigger("running")
def clear_log(self):
self.tlog = []