summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-04-04 13:15:56 +0200
committerFlorian Bruhin <me@the-compiler.org>2021-04-04 13:15:56 +0200
commita8d5ce13e8dd3e996d839d3bb80d2f391ff37100 (patch)
treefe3dbe3c2f06e7456d22d883cf41ad278b8b0d74 /tests
parented45c7fdc59ac376dc4b9a51811760aaabbd8ad8 (diff)
downloadqutebrowser-a8d5ce13e8dd3e996d839d3bb80d2f391ff37100.tar.gz
qutebrowser-a8d5ce13e8dd3e996d839d3bb80d2f391ff37100.zip
Add URL pattern support for :config-unset
See #5856
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/config/test_configcommands.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/unit/config/test_configcommands.py b/tests/unit/config/test_configcommands.py
index 72af2ad3e..6aa5d3c11 100644
--- a/tests/unit/config/test_configcommands.py
+++ b/tests/unit/config/test_configcommands.py
@@ -460,6 +460,25 @@ class TestUnsetAndClear:
with pytest.raises(cmdutils.CommandError, match="No option 'tabs'"):
commands.config_unset('tabs')
+ @pytest.mark.parametrize('set_global', [True, False])
+ def test_unset_pattern(self, commands, config_stub, set_global):
+ name = 'content.javascript.enabled'
+ pattern = urlmatch.UrlPattern('*://example.com')
+ url = QUrl('https://example.com')
+
+ if set_global:
+ config_stub.set_obj(name, False)
+ global_value = False
+ local_value = True
+ else:
+ global_value = True
+ local_value = False
+
+ config_stub.set_obj(name, local_value, pattern=pattern)
+ commands.config_unset(name, pattern=str(pattern))
+ assert config_stub.get_obj(name, url=url) == global_value
+ assert config_stub.get_obj(name, url=url, fallback=False) == usertypes.UNSET
+
@pytest.mark.parametrize('save', [True, False])
def test_clear(self, commands, config_stub, yaml_value, save):
name = 'tabs.show'