diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-07-18 09:58:57 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-07-18 10:03:10 +1200 |
commit | f9e4249499f369932241b722e705575a0730fc75 (patch) | |
tree | 02c2f47c1a482563d3be66e4209e64519b8ae7b7 /test | |
parent | 7b57c2948eb5bdfc5e1704e30fdd12e721f345ea (diff) | |
download | mitmproxy-f9e4249499f369932241b722e705575a0730fc75.tar.gz mitmproxy-f9e4249499f369932241b722e705575a0730fc75.tar.bz2 mitmproxy-f9e4249499f369932241b722e705575a0730fc75.zip |
Add a toggller helper to Options, start using it in mitmproxy console
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/test_options.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/mitmproxy/test_options.py b/test/mitmproxy/test_options.py index cdb0d765..af619b27 100644 --- a/test/mitmproxy/test_options.py +++ b/test/mitmproxy/test_options.py @@ -52,6 +52,17 @@ def test_setter(): o.setter("nonexistent") +def test_toggler(): + o = TO(two=True) + f = o.toggler("two") + f() + assert o.two is False + f() + assert o.two is True + with tutils.raises("no such option"): + o.toggler("nonexistent") + + def test_rollback(): o = TO(one="two") |