aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-07-30 03:47:25 +0200
committerGitHub <noreply@github.com>2017-07-30 03:47:25 +0200
commitf844c68e2ec6b9daedc376f75ae0a4e09a4ac22c (patch)
tree008202efed288aeb2a189f6597d1718ced59c851 /test
parent7594dac94bede4b03660c76af9e353d8646cdf39 (diff)
parent6a41122990017491222602753441de8ac438b735 (diff)
downloadmitmproxy-f844c68e2ec6b9daedc376f75ae0a4e09a4ac22c.tar.gz
mitmproxy-f844c68e2ec6b9daedc376f75ae0a4e09a4ac22c.tar.bz2
mitmproxy-f844c68e2ec6b9daedc376f75ae0a4e09a4ac22c.zip
Merge pull request #2485 from mhils/silent-option-redeclaration
Make option redeclaration silent if signature is the same
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_addonmanager.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/mitmproxy/test_addonmanager.py b/test/mitmproxy/test_addonmanager.py
index 722d108b..fc048571 100644
--- a/test/mitmproxy/test_addonmanager.py
+++ b/test/mitmproxy/test_addonmanager.py
@@ -91,7 +91,15 @@ def test_loader():
with taddons.context() as tctx:
l = addonmanager.Loader(tctx.master)
l.add_option("custom_option", bool, False, "help")
+ assert "custom_option" in l.master.options
+
+ # calling this again with the same signature is a no-op.
l.add_option("custom_option", bool, False, "help")
+ assert not tctx.master.has_log("Over-riding existing option")
+
+ # a different signature should emit a warning though.
+ l.add_option("custom_option", bool, True, "help")
+ assert tctx.master.has_log("Over-riding existing option")
def cmd(a: str) -> str:
return "foo"