aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2017-04-26 07:13:36 +1200
committerAldo Cortesi <aldo@corte.si>2017-04-26 09:01:40 +1200
commit7aa208189477f8c5fcd3f7850e1c98fade757f11 (patch)
treea154ea6b2fca6412df3f7d63eaa40e9b3ce7456f /mitmproxy/test
parente6eeab60946e61047ed858422badbda189a6f9e8 (diff)
downloadmitmproxy-7aa208189477f8c5fcd3f7850e1c98fade757f11.tar.gz
mitmproxy-7aa208189477f8c5fcd3f7850e1c98fade757f11.tar.bz2
mitmproxy-7aa208189477f8c5fcd3f7850e1c98fade757f11.zip
Remove watchdog, solidify script testing
- Remove the watchdog dependency. We now just stat the script file every 2 seconds to check for an updated mtime. - Further solidify our script testing, and in particular make the example tests nicer. These should exemplify how we want users to test their own addon scripts. More work on addon testing to follow.
Diffstat (limited to 'mitmproxy/test')
-rw-r--r--mitmproxy/test/taddons.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/mitmproxy/test/taddons.py b/mitmproxy/test/taddons.py
index 3dbccba2..471c9c31 100644
--- a/mitmproxy/test/taddons.py
+++ b/mitmproxy/test/taddons.py
@@ -112,9 +112,12 @@ class context:
)
def script(self, path):
+ """
+ Loads a script from path, and returns the enclosed addon.
+ """
sc = script.Script(path)
loader = addonmanager.Loader(self.master)
- sc.load(loader)
- for a in addonmanager.traverse(sc.addons):
- getattr(a, "load", lambda x: None)(loader)
- return sc
+ self.master.addons.invoke_addon(sc, "load", loader)
+ self.configure(sc)
+ self.master.addons.invoke_addon(sc, "tick")
+ return sc.addons[0] if sc.addons else None