Beispiel #1
0
def test_bind_completion(qtmodeltester, monkeypatch, stubs, config_stub,
                         key_config_stub):
    """Test the results of keybinding command completion.

    Validates that:
        - only non-hidden and non-deprecated commands are included
        - the command description is shown in the desc column
        - the binding (if any) is shown in the misc column
        - aliases are included
    """
    _patch_cmdutils(monkeypatch, stubs,
                    'qutebrowser.completion.models.miscmodels.cmdutils')
    config_stub.data['aliases'] = {'rock': 'roll'}
    key_config_stub.set_bindings_for('normal', {'s': 'stop',
                                                'rr': 'roll',
                                                'ro': 'rock'})
    model = miscmodels.BindCompletionModel()
    qtmodeltester.data_display_may_return_none = True
    qtmodeltester.check(model)

    _check_completions(model, {
        "Commands": [
            ('stop', 'stop qutebrowser', 's'),
            ('drop', 'drop all user data', ''),
            ('hide', '', ''),
            ('roll', 'never gonna give you up', 'rr'),
            ('rock', "Alias for 'roll'", 'ro'),
        ]
    })
Beispiel #2
0
def _init_bind_completion():
    """Initialize the command completion model."""
    log.completion.debug("Initializing bind completion.")
    model = miscmodels.BindCompletionModel()
    _instances[usertypes.Completion.bind] = model