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:
parent
5255a71bc5
commit
f5b1019d4d
@ -398,7 +398,7 @@ class ConfigStub(QObject):
|
|||||||
"""
|
"""
|
||||||
return self.data[name]
|
return self.data[name]
|
||||||
|
|
||||||
def get(self, sect, opt):
|
def get(self, sect, opt, raw=True):
|
||||||
"""Get a value from the config."""
|
"""Get a value from the config."""
|
||||||
data = self.data[sect]
|
data = self.data[sect]
|
||||||
try:
|
try:
|
||||||
|
@ -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):
|
def _get_completions(model):
|
||||||
"""Collect all the completion entries of a model, organized by category.
|
"""Collect all the completion entries of a model, organized by category.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user