diff options
author | Aldo Cortesi <aldo@corte.si> | 2017-03-14 09:22:44 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2017-03-14 09:40:33 +1300 |
commit | b745428b5c4e89753a83fe228cb5478327eeb540 (patch) | |
tree | 7681c0f345d13243e1c28deb8c8144c2061a26e4 /test | |
parent | 2832e790fd27d45f8bfbed1b4ce7f1e15910018d (diff) | |
download | mitmproxy-b745428b5c4e89753a83fe228cb5478327eeb540.tar.gz mitmproxy-b745428b5c4e89753a83fe228cb5478327eeb540.tar.bz2 mitmproxy-b745428b5c4e89753a83fe228cb5478327eeb540.zip |
Enable custom options in config files
We also now ignore unknown options in config files by default, and print a
warning if verbosity is incremented.
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/test_optmanager.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/mitmproxy/test_optmanager.py b/test/mitmproxy/test_optmanager.py index 012c463c..df392829 100644 --- a/test/mitmproxy/test_optmanager.py +++ b/test/mitmproxy/test_optmanager.py @@ -83,10 +83,11 @@ def test_options(): with pytest.raises(TypeError): TO(nonexistent = "value") - with pytest.raises(Exception, match="No such option"): + with pytest.raises(Exception, match="Unknown options"): o.nonexistent = "value" - with pytest.raises(Exception, match="No such option"): + with pytest.raises(Exception, match="Unknown options"): o.update(nonexistent = "value") + assert o.update_known(nonexistent = "value") == {"nonexistent": "value"} rec = [] @@ -226,9 +227,7 @@ def test_serialize(): t = "" optmanager.load(o2, t) - - with pytest.raises(exceptions.OptionsError, matches='No such option: foobar'): - optmanager.load(o2, "foobar: '123'") + assert optmanager.load(o2, "foobar: '123'") == {"foobar": "123"} def test_serialize_defaults(): @@ -252,7 +251,11 @@ def test_saving(tmpdir): with open(dst, 'a') as f: f.write("foobar: '123'") - with pytest.raises(exceptions.OptionsError, matches=''): + assert optmanager.load_paths(o, dst) == {"foobar": "123"} + + with open(dst, 'a') as f: + f.write("'''") + with pytest.raises(exceptions.OptionsError): optmanager.load_paths(o, dst) |