From 1b3f86e70938d43b5d1f702ef6ca18ecfa32c636 Mon Sep 17 00:00:00 2001 From: Pierre Gordon Date: Fri, 19 Apr 2019 13:10:39 -0500 Subject: Verify ignore_hosts & allow_hosts are mutually exclusive --- test/mitmproxy/proxy/test_config.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/mitmproxy/proxy/test_config.py b/test/mitmproxy/proxy/test_config.py index 1da031c6..1319d1a9 100644 --- a/test/mitmproxy/proxy/test_config.py +++ b/test/mitmproxy/proxy/test_config.py @@ -17,3 +17,12 @@ class TestProxyConfig: opts.certs = [tdata.path("mitmproxy/data/dumpfile-011")] with pytest.raises(exceptions.OptionsError, match="Invalid certificate format"): ProxyConfig(opts) + + def test_cannot_set_both_allow_and_filter_options(self): + opts = options.Options() + opts.ignore_hosts = ["foo"] + opts.allow_hosts = ["bar"] + with pytest.raises(exceptions.OptionsError, match="--ignore-hosts and --allow-hosts are " + "mutually exclusive; please choose " + "one."): + ProxyConfig(opts) -- cgit v1.2.3