diff --git a/tests/helpers/stubs.py b/tests/helpers/stubs.py index f338d64ec..11078ca8f 100644 --- a/tests/helpers/stubs.py +++ b/tests/helpers/stubs.py @@ -398,7 +398,7 @@ class ConfigStub(QObject): """ return self.data[name] - def get(self, sect, opt): + def get(self, sect, opt, raw=True): """Get a value from the config.""" data = self.data[sect] try: diff --git a/tests/unit/completion/test_models.py b/tests/unit/completion/test_models.py index 731d05b19..0fd1a1bbc 100644 --- a/tests/unit/completion/test_models.py +++ b/tests/unit/completion/test_models.py @@ -215,6 +215,22 @@ def test_setting_section_completion(monkeypatch, stubs): ] +def test_setting_option_completion(monkeypatch, stubs, config_stub): + module = 'qutebrowser.completion.models.configmodel' + _patch_configdata(monkeypatch, stubs, module + '.configdata.DATA') + config_stub.data = {'ui': {'gesture': 'off', + 'mind': 'on', + 'voice': 'sometimes'}} + actual = _get_completions(configmodel.SettingOptionCompletionModel('ui')) + assert actual == [ + ("ui", [ + ('gesture', 'Waggle your hands to control qutebrowser', 'off'), + ('mind', 'Enable mind-control ui (experimental)', 'on'), + ('voice', 'Whether to respond to voice commands', 'sometimes'), + ]) + ] + + def _get_completions(model): """Collect all the completion entries of a model, organized by category.