mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
Verify ignore_hosts & allow_hosts are mutually exclusive
This commit is contained in:
parent
8d0c800d15
commit
1b3f86e709
@ -69,7 +69,7 @@ class Options(optmanager.OptManager):
|
||||
)
|
||||
self.add_option(
|
||||
"allow_hosts", Sequence[str], [],
|
||||
"Opposite of --ignore_hosts."
|
||||
"Opposite of --ignore-hosts."
|
||||
)
|
||||
self.add_option(
|
||||
"listen_host", str, "",
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user