Unit test config option completion.

Had to add the `raw` parameter to ConfigStub.get as the setting option
completion model passes this argument explicitly (although the docs say
only raw=True is supported).
This commit is contained in:
Ryan Roden-Corrent 2016-06-18 06:55:17 -04:00
parent 5255a71bc5
commit f5b1019d4d
2 changed files with 17 additions and 1 deletions

View File

@ -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:

View File

@ -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.