aboutsummaryrefslogtreecommitdiffstats
path: root/test/mitmproxy/test_addonmanager.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/mitmproxy/test_addonmanager.py')
-rw-r--r--test/mitmproxy/test_addonmanager.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/mitmproxy/test_addonmanager.py b/test/mitmproxy/test_addonmanager.py
index ef34371f..e7be25b8 100644
--- a/test/mitmproxy/test_addonmanager.py
+++ b/test/mitmproxy/test_addonmanager.py
@@ -11,6 +11,7 @@ class TAddon:
def __init__(self, name):
self.name = name
self.tick = True
+ self.custom_called = False
def __repr__(self):
return "Addon(%s)" % self.name
@@ -18,11 +19,17 @@ class TAddon:
def done(self):
pass
+ def event_custom(self):
+ self.custom_called = True
+
def test_simple():
o = options.Options()
m = master.Master(o, proxy.DummyServer(o))
a = addonmanager.AddonManager(m)
+ with pytest.raises(exceptions.AddonError):
+ a.invoke_addon(TAddon("one"), "done")
+
a.add(TAddon("one"))
assert a.get("one")
assert not a.get("two")
@@ -33,3 +40,8 @@ def test_simple():
a.trigger("done")
with pytest.raises(exceptions.AddonError):
a.trigger("tick")
+
+ ta = TAddon("one")
+ a.add(ta)
+ a.trigger("custom")
+ assert ta.custom_called