diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2017-03-16 15:40:43 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2017-03-16 18:33:24 +1300 |
commit | c5e0dc64b9b367eae8f4af66a4917c738dd87569 (patch) | |
tree | 8577458ea0e643e0f48d48e39dcb4f80a4317094 /mitmproxy/test | |
parent | 3de982900381b9d3743e65defbfa413453cd3836 (diff) | |
download | mitmproxy-c5e0dc64b9b367eae8f4af66a4917c738dd87569.tar.gz mitmproxy-c5e0dc64b9b367eae8f4af66a4917c738dd87569.tar.bz2 mitmproxy-c5e0dc64b9b367eae8f4af66a4917c738dd87569.zip |
Rip out master handler mechanism
All events are now handled by addons, and we no longer support any events on
master.
Diffstat (limited to 'mitmproxy/test')
-rw-r--r-- | mitmproxy/test/taddons.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/mitmproxy/test/taddons.py b/mitmproxy/test/taddons.py index 29ae7aa9..8bc174c7 100644 --- a/mitmproxy/test/taddons.py +++ b/mitmproxy/test/taddons.py @@ -3,29 +3,26 @@ import contextlib import mitmproxy.master import mitmproxy.options from mitmproxy import proxy +from mitmproxy import addonmanager from mitmproxy import eventsequence -class _AddonWrapper: - def __init__(self, master, addons): - self.master = master - self.addons = addons +class TestAddons(addonmanager.AddonManager): + def __init__(self, master): + super().__init__(master) def trigger(self, event, *args, **kwargs): if event == "log": self.master.logs.append(args[0]) else: self.master.events.append((event, args, kwargs)) - return self.addons.trigger(event, *args, **kwargs) - - def __getattr__(self, attr): - return getattr(self.addons, attr) + super().trigger(event, *args, **kwargs) class RecordingMaster(mitmproxy.master.Master): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.addons = _AddonWrapper(self, self.addons) + self.addons = TestAddons(self) self.events = [] self.logs = [] @@ -76,7 +73,7 @@ class context: Cycles the flow through the events for the flow. Stops if a reply is taken (as in flow interception). """ - f.reply._state = "handled" + f.reply._state = "start" for evt, arg in eventsequence.iterate(f): h = getattr(addon, evt, None) if h: |