def test_command_completion(qtmodeltester, monkeypatch, stubs, config_stub, key_config_stub): """Test the results of 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.command() model.set_pattern('') qtmodeltester.data_display_may_return_none = True qtmodeltester.check(model) _check_completions( model, { "Commands": [ ('drop', 'drop all user data', ''), ('rock', "Alias for 'roll'", 'ro'), ('roll', 'never gonna give you up', 'rr'), ('stop', 'stop qutebrowser', 's'), ] })
def test_command_completion(qtmodeltester, cmdutils_stub, configdata_stub, key_config_stub, info): """Test the results of 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 """ model = miscmodels.command(info=info) model.set_pattern('') qtmodeltester.data_display_may_return_none = True qtmodeltester.check(model) _check_completions(model, { "Commands": [ ('open', 'open a url', ''), ('q', "Alias for 'quit'", ''), ('quit', 'quit qutebrowser', 'ZQ, <ctrl+q>'), ] })
def test_command_completion(qtmodeltester, cmdutils_stub, configdata_stub, key_config_stub, info): """Test the results of 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 """ model = miscmodels.command(info=info) model.set_pattern('') qtmodeltester.check(model) _check_completions(model, { "Commands": [ ('open', 'open a url', ''), ('q', "Alias for 'quit'", ''), ('quit', 'quit qutebrowser', 'ZQ, <Ctrl+q>'), ('tab-close', 'Close the current tab.', ''), ] })