Unit-test configmodel arg filtering.

Test that values the user has already input are omitted from the
suggestions. This brings configmodel coverage back to 100%.
This commit is contained in:
Ryan Roden-Corrent 2018-03-31 15:57:08 -04:00
parent 707fc1176d
commit bca07eebba
No known key found for this signature in database
GPG Key ID: 4E5072F68872BC04

View File

@ -716,6 +716,44 @@ def test_setting_value_completion_invalid(info):
assert configmodel.value(optname='foobarbaz', info=info) is None assert configmodel.value(optname='foobarbaz', info=info) is None
@pytest.mark.parametrize('args, expected', [
([], {
"Current/Default": [
('true', 'Current value', None),
('true', 'Default value', None),
],
"Completions": [
('false', '', None),
('true', '', None),
],
}),
(['false'], {
"Current/Default": [
('true', 'Current value', None),
('true', 'Default value', None),
],
"Completions": [
('true', '', None),
],
}),
(['true'], {
"Completions": [
('false', '', None),
],
}),
(['false', 'true'], {}),
])
def test_setting_value_cycle(qtmodeltester, config_stub, configdata_stub,
info, args, expected):
opt = 'content.javascript.enabled'
model = configmodel.value(opt, *args, info=info)
model.set_pattern('')
qtmodeltester.data_display_may_return_none = True
qtmodeltester.check(model)
_check_completions(model, expected)
def test_bind_completion(qtmodeltester, cmdutils_stub, config_stub, def test_bind_completion(qtmodeltester, cmdutils_stub, config_stub,
key_config_stub, configdata_stub, info): key_config_stub, configdata_stub, info):
"""Test the results of keybinding command completion. """Test the results of keybinding command completion.