Beispiel #1
0
def test_setting_value_completion(monkeypatch, stubs, config_stub):
    module = 'qutebrowser.completion.models.configmodel'
    _patch_configdata(monkeypatch, stubs, module + '.configdata.DATA')
    config_stub.data = {'general': {'volume': '0'}}
    model = configmodel.SettingValueCompletionModel('general', 'volume')
    actual = _get_completions(model)
    assert actual == [("Current/Default", [
        ('0', 'Current value', ''),
        ('11', 'Default value', ''),
    ]), ("Completions", [
        ('0', '', ''),
        ('11', '', ''),
    ])]
Beispiel #2
0
def _init_setting_completions():
    """Initialize setting completion models."""
    log.completion.debug("Initializing setting completion.")
    _instances[usertypes.Completion.section] = (
        configmodel.SettingSectionCompletionModel())
    _instances[usertypes.Completion.option] = {}
    _instances[usertypes.Completion.value] = {}
    for sectname in configdata.DATA:
        opt_model = configmodel.SettingOptionCompletionModel(sectname)
        _instances[usertypes.Completion.option][sectname] = opt_model
        _instances[usertypes.Completion.value][sectname] = {}
        for opt in configdata.DATA[sectname]:
            val_model = configmodel.SettingValueCompletionModel(sectname, opt)
            _instances[usertypes.Completion.value][sectname][opt] = val_model
Beispiel #3
0
def test_setting_value_completion(qtmodeltester, monkeypatch, stubs,
                                  config_stub):
    module = 'qutebrowser.completion.models.configmodel'
    _patch_configdata(monkeypatch, stubs, module + '.configdata.DATA')
    config_stub.data = {'general': {'volume': '0'}}
    model = configmodel.SettingValueCompletionModel('general', 'volume')
    qtmodeltester.data_display_may_return_none = True
    qtmodeltester.check(model)

    _check_completions(model, {
        "Current/Default": [
            ('0', 'Current value', ''),
            ('11', 'Default value', ''),
        ],
        "Completions": [
            ('0', '', ''),
            ('11', '', ''),
        ]
    })