diff options
author | Aldo Cortesi <aldo@corte.si> | 2018-05-27 10:55:15 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-27 10:55:15 +1200 |
commit | dbf01cd34db98350732062fac9e7e1bd64a17ea9 (patch) | |
tree | cd83bcce07c071af589efcfa8168bedd715e560b /test | |
parent | d1e3968fa887f601339ac158e4c0f5fff4b18a49 (diff) | |
parent | ec2ae19e22613eadffdb1ff17c1e7b0a8e6a4422 (diff) | |
download | mitmproxy-dbf01cd34db98350732062fac9e7e1bd64a17ea9.tar.gz mitmproxy-dbf01cd34db98350732062fac9e7e1bd64a17ea9.tar.bz2 mitmproxy-dbf01cd34db98350732062fac9e7e1bd64a17ea9.zip |
Merge pull request #3163 from cortesi/defer
Use deferral mechanism for cfg file options
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/test_optmanager.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/test/mitmproxy/test_optmanager.py b/test/mitmproxy/test_optmanager.py index 4356434b..1e4f09d4 100644 --- a/test/mitmproxy/test_optmanager.py +++ b/test/mitmproxy/test_optmanager.py @@ -269,11 +269,13 @@ def test_serialize(): t = "# a comment" optmanager.load(o2, t) - assert optmanager.load(o2, "foobar: '123'") == {"foobar": "123"} + optmanager.load(o2, "foobar: '123'") + assert o2.deferred == {"foobar": "123"} t = "" optmanager.load(o2, t) - assert optmanager.load(o2, "foobar: '123'") == {"foobar": "123"} + optmanager.load(o2, "foobar: '123'") + assert o2.deferred == {"foobar": "123"} def test_serialize_defaults(): @@ -297,7 +299,8 @@ def test_saving(tmpdir): with open(dst, 'a') as f: f.write("foobar: '123'") - assert optmanager.load_paths(o, dst) == {"foobar": "123"} + optmanager.load_paths(o, dst) + assert o.deferred == {"foobar": "123"} with open(dst, 'a') as f: f.write("'''") @@ -426,13 +429,13 @@ def test_set(): assert opts.seqstr == [] with pytest.raises(exceptions.OptionsError): - opts.set("deferred=wobble") + opts.set("deferredoption=wobble") - opts.set("deferred=wobble", defer=True) - assert "deferred" in opts._deferred + opts.set("deferredoption=wobble", defer=True) + assert "deferredoption" in opts.deferred opts.process_deferred() - assert "deferred" in opts._deferred - opts.add_option("deferred", str, "default", "help") + assert "deferredoption" in opts.deferred + opts.add_option("deferredoption", str, "default", "help") opts.process_deferred() - assert "deferred" not in opts._deferred - assert opts.deferred == "wobble" + assert "deferredoption" not in opts.deferred + assert opts.deferredoption == "wobble" |