Ejemplo n.º 1
0
def test_setting_section_completion(monkeypatch, stubs):
    module = 'qutebrowser.completion.models.configmodel'
    _patch_configdata(monkeypatch, stubs, module + '.configdata.DATA')
    _patch_config_section_desc(monkeypatch, stubs,
                               module + '.configdata.SECTION_DESC')
    actual = _get_completions(configmodel.SettingSectionCompletionModel())
    assert actual == [("Sections", [
        ('general', 'General/miscellaneous options.', ''),
        ('ui', 'General options related to the user interface.', ''),
    ])]
Ejemplo n.º 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
Ejemplo n.º 3
0
def test_setting_section_completion(qtmodeltester, monkeypatch, stubs):
    module = 'qutebrowser.completion.models.configmodel'
    _patch_configdata(monkeypatch, stubs, module + '.configdata.DATA')
    _patch_config_section_desc(monkeypatch, stubs,
                               module + '.configdata.SECTION_DESC')
    model = configmodel.SettingSectionCompletionModel()
    qtmodeltester.data_display_may_return_none = True
    qtmodeltester.check(model)

    _check_completions(model, {
        "Sections": [
            ('general', 'General/miscellaneous options.', ''),
            ('ui', 'General options related to the user interface.', ''),
        ]
    })