diff options
author | Aldo Cortesi <aldo@corte.si> | 2018-02-24 12:13:52 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2018-02-24 12:13:52 +1300 |
commit | 4522a6f7b754be26084c40df5ecc7349023a692e (patch) | |
tree | fb3eeba45aebfb77558aba0ab0ed033f84e52099 /mitmproxy/test | |
parent | 58ccad7576e5fd33e937aba58df2f9edc389e52e (diff) | |
download | mitmproxy-4522a6f7b754be26084c40df5ecc7349023a692e.tar.gz mitmproxy-4522a6f7b754be26084c40df5ecc7349023a692e.tar.bz2 mitmproxy-4522a6f7b754be26084c40df5ecc7349023a692e.zip |
Start moving addon options into /addons
This takes the first few steps:
- Extends taddons to make loading addon options easier
- Removes dependencies in the test suite on options in addons
- Tweaks command-line parser autocreation to ignore nonexistent options. This
lets us load common options without over-depending on loaded addons.
Diffstat (limited to 'mitmproxy/test')
-rw-r--r-- | mitmproxy/test/taddons.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mitmproxy/test/taddons.py b/mitmproxy/test/taddons.py index d966f1d5..12fc0986 100644 --- a/mitmproxy/test/taddons.py +++ b/mitmproxy/test/taddons.py @@ -59,7 +59,7 @@ class context: provides a number of helper methods for common testing scenarios. """ - def __init__(self, master=None, options=None): + def __init__(self, *addons, master=None, options=None): options = options or mitmproxy.options.Options() self.master = master or RecordingMaster( options @@ -67,6 +67,10 @@ class context: self.options = self.master.options self.wrapped = None + loader = addonmanager.Loader(self.master) + for a in addons: + self.master.addons.invoke_addon(a, "load", loader) + def ctx(self): """ Returns a new handler context. |