summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarza <arza@arza.us>2019-03-18 10:04:22 +0200
committerFlorian Bruhin <me@the-compiler.org>2019-03-18 11:15:22 +0100
commit99a4f4a034b2f3460118ed8e6b80373e42e2194e (patch)
treee8d33f6b9dc05615cc589bf3c7a8c486698c4c1b
parent6f3f500404d7732c29836884808259eb2162a8ca (diff)
downloadqutebrowser-99a4f4a034b2f3460118ed8e6b80373e42e2194e.tar.gz
qutebrowser-99a4f4a034b2f3460118ed8e6b80373e42e2194e.zip
Add tests for :config-dict-add, :config-dict-remove, :config-list-add and :config-list-remove with invalid option
-rw-r--r--tests/unit/config/test_configcommands.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unit/config/test_configcommands.py b/tests/unit/config/test_configcommands.py
index e7140bd11..1b91943c5 100644
--- a/tests/unit/config/test_configcommands.py
+++ b/tests/unit/config/test_configcommands.py
@@ -299,6 +299,12 @@ class TestAdd:
else:
assert yaml_value(name)[-1] == value
+ def test_list_add_invalid_option(self, commands):
+ with pytest.raises(
+ cmdutils.CommandError,
+ match="No option 'nonexistent'"):
+ commands.config_list_add('nonexistent', 'value')
+
def test_list_add_non_list(self, commands):
with pytest.raises(
cmdutils.CommandError,
@@ -342,6 +348,12 @@ class TestAdd:
"overwrite!"):
commands.config_dict_add(name, key, value, replace=False)
+ def test_dict_add_invalid_option(self, commands):
+ with pytest.raises(
+ cmdutils.CommandError,
+ match="No option 'nonexistent'"):
+ commands.config_dict_add('nonexistent', 'key', 'value')
+
def test_dict_add_non_dict(self, commands):
with pytest.raises(
cmdutils.CommandError,
@@ -371,6 +383,12 @@ class TestRemove:
else:
assert value not in yaml_value(name)
+ def test_list_remove_invalid_option(self, commands):
+ with pytest.raises(
+ cmdutils.CommandError,
+ match="No option 'nonexistent'"):
+ commands.config_list_remove('nonexistent', 'value')
+
def test_list_remove_non_list(self, commands):
with pytest.raises(
cmdutils.CommandError,
@@ -396,6 +414,12 @@ class TestRemove:
else:
assert key not in yaml_value(name)
+ def test_dict_remove_invalid_option(self, commands):
+ with pytest.raises(
+ cmdutils.CommandError,
+ match="No option 'nonexistent'"):
+ commands.config_dict_remove('nonexistent', 'key')
+
def test_dict_remove_non_dict(self, commands):
with pytest.raises(
cmdutils.CommandError,