diff options
-rw-r--r-- | setup.cfg | 2 | ||||
-rw-r--r-- | test/mitmproxy/test_optmanager.py | 22 |
2 files changed, 15 insertions, 9 deletions
@@ -41,7 +41,6 @@ exclude = mitmproxy/flow.py mitmproxy/io_compat.py mitmproxy/master.py - mitmproxy/optmanager.py pathod/pathoc.py pathod/pathod.py pathod/test.py @@ -74,7 +73,6 @@ exclude = mitmproxy/net/http/url.py mitmproxy/net/tcp.py mitmproxy/options.py - mitmproxy/optmanager.py mitmproxy/proxy/config.py mitmproxy/proxy/modes/http_proxy.py mitmproxy/proxy/modes/reverse_proxy.py diff --git a/test/mitmproxy/test_optmanager.py b/test/mitmproxy/test_optmanager.py index 65691fdf..161b0dcf 100644 --- a/test/mitmproxy/test_optmanager.py +++ b/test/mitmproxy/test_optmanager.py @@ -30,6 +30,14 @@ class TD2(TD): super().__init__(three=three, **kwargs) +class TM(optmanager.OptManager): + def __init__(self, one="one", two=["foo"], three=None): + self.one = one + self.two = two + self.three = three + super().__init__() + + def test_defaults(): assert TD2.default("one") == "done" assert TD2.default("two") == "dtwo" @@ -203,6 +211,9 @@ def test_serialize(): t = "" o2.load(t) + with pytest.raises(exceptions.OptionsError, matches='No such option: foobar'): + o2.load("foobar: '123'") + def test_serialize_defaults(): o = options.Options() @@ -224,13 +235,10 @@ def test_saving(): o.load_paths(dst) assert o.three == "foo" - -class TM(optmanager.OptManager): - def __init__(self, one="one", two=["foo"], three=None): - self.one = one - self.two = two - self.three = three - super().__init__() + with open(dst, 'a') as f: + f.write("foobar: '123'") + with pytest.raises(exceptions.OptionsError, matches=''): + o.load_paths(dst) def test_merge(): |