diff options
-rw-r--r-- | tests/unit/config/test_configcommands.py | 24 |
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, |