def test_help_completion(qtmodeltester, cmdutils_stub, key_config_stub,
                         configdata_stub, config_stub, info):
    """Test the results of command completion.

    Validates that:
        - only 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 not included
        - only the first line of a multiline description is shown
    """
    model = miscmodels.helptopic(info=info)
    model.set_pattern('')
    qtmodeltester.data_display_may_return_none = True
    qtmodeltester.check(model)

    _check_completions(
        model, {
            "Commands":
            [(':open', 'open a url', ''),
             (':quit', 'quit qutebrowser', 'ZQ, <ctrl+q>'),
             (':scroll', 'Scroll the current tab in the given direction.', '')
             ],
            "Settings": [
                ('aliases', 'Aliases for commands.', None),
                ('bindings.commands', 'Default keybindings', None),
                ('bindings.default', 'Default keybindings', None),
            ]
        })
Exemplo n.º 2
0
def test_help_completion(qtmodeltester, cmdutils_stub, key_config_stub,
                         configdata_stub, config_stub, info):
    """Test the results of command completion.

    Validates that:
        - only 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 not included
        - only the first line of a multiline description is shown
    """
    model = miscmodels.helptopic(info=info)
    model.set_pattern('')
    qtmodeltester.check(model)

    _check_completions(
        model, {
            "Commands": [
                (':open', 'open a url', ''),
                (':quit', 'quit qutebrowser', 'ZQ, <Ctrl+q>'),
                (':scroll', 'Scroll the current tab in the given direction.',
                 ''),
                (':tab-close', 'Close the current tab.', ''),
            ],
            "Settings": [
                ('aliases', 'Aliases for commands.', None),
                ('bindings.commands', 'Default keybindings', None),
                ('bindings.default', 'Default keybindings', None),
                ('completion.open_categories', 'Which categories to show (in '
                 'which order) in the :open completion.', None),
                ('content.javascript.enabled', 'Enable/Disable JavaScript',
                 None),
                ('url.searchengines', 'searchengines list', None),
            ],
        })
Exemplo n.º 3
0
def test_help_completion(qtmodeltester, cmdutils_stub, key_config_stub,
                         configdata_stub, config_stub, info):
    """Test the results of command completion.

    Validates that:
        - only 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 not included
        - only the first line of a multiline description is shown
    """
    model = miscmodels.helptopic(info=info)
    model.set_pattern('')
    qtmodeltester.data_display_may_return_none = True
    qtmodeltester.check(model)

    _check_completions(model, {
        "Commands": [
            (':open', 'open a url', ''),
            (':quit', 'quit qutebrowser', 'ZQ, <ctrl+q>'),
            (':scroll', 'Scroll the current tab in the given direction.', '')
        ],
        "Settings": [
            ('aliases', 'Aliases for commands.', None),
            ('bindings.commands', 'Default keybindings', None),
            ('bindings.default', 'Default keybindings', None),
        ]
    })
Exemplo n.º 4
0
def test_help_completion(qtmodeltester, cmdutils_stub, key_config_stub,
                         configdata_stub, config_stub, info):
    """Test the results of command completion.

    Validates that:
        - only 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 not included
        - only the first line of a multiline description is shown
    """
    model = miscmodels.helptopic(info=info)
    model.set_pattern('')
    qtmodeltester.check(model)

    _check_completions(model, {
        "Commands": [
            (':open', 'open a url', ''),
            (':quit', 'quit qutebrowser', 'ZQ, <Ctrl+q>'),
            (':scroll', 'Scroll the current tab in the given direction.', ''),
            (':tab-close', 'Close the current tab.', ''),
        ],
        "Settings": [
            ('aliases', 'Aliases for commands.', None),
            ('bindings.commands', 'Default keybindings', None),
            ('bindings.default', 'Default keybindings', None),
            ('completion.open_categories', 'Which categories to show (in '
             'which order) in the :open completion.', None),
            ('content.javascript.enabled', 'Enable/Disable JavaScript', None),
            ('url.searchengines', 'searchengines list', None),
        ],
    })
Exemplo n.º 5
0
def test_help_completion(qtmodeltester, cmdutils_stub, key_config_stub,
                         configdata_stub, config_stub, info):
    """Test the results of command completion.

    Validates that:
        - only 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 not included
        - only the first line of a multiline description is shown
    """
    model = miscmodels.helptopic(info=info)
    model.set_pattern('')
    qtmodeltester.check(model)

    _check_completions(model, {
        "Commands": [
            (':open', 'open a url', ''),
            (':quit', 'quit qutebrowser', 'ZQ, <Ctrl+q>'),
            (':scroll', 'Scroll the current tab in the given direction.', ''),
            (':tab-close', 'Close the current tab.', ''),
        ],
        "Settings": [
            (
                'aliases',
                'Aliases for commands.',
                '{"q": "quit"}',
            ),
            (
                'bindings.commands',
                'Custom keybindings',
                ('{"normal": {"<Ctrl+q>": "quit", "I": "invalid", "ZQ": "quit", '
                 '"d": "scroll down"}}'),
            ),
            (
                'bindings.default',
                'Default keybindings',
                '{"normal": {"<Ctrl+q>": "quit", "d": "tab-close"}}',
            ),
            (
                'completion.open_categories',
                'Which categories to show (in which order) in the :open completion.',
                '["searchengines", "quickmarks", "bookmarks", "history"]',
            ),
            (
                'content.javascript.enabled',
                'Enable/Disable JavaScript',
                'true'
            ),
            (
                'url.searchengines',
                'searchengines list',
                ('{"DEFAULT": "https://duckduckgo.com/?q={}", '
                 '"google": "https://google.com/?q={}"}'),
            ),
        ],
    })
Exemplo n.º 6
0
def test_help_completion(qtmodeltester, monkeypatch, stubs, key_config_stub):
    """Test the results of command completion.

    Validates that:
        - only 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
        - only the first line of a multiline description is shown
    """
    module = 'qutebrowser.completion.models.miscmodels'
    key_config_stub.set_bindings_for('normal', {'s': 'stop', 'rr': 'roll'})
    _patch_cmdutils(monkeypatch, stubs, module + '.cmdutils')
    _patch_configdata(monkeypatch, stubs, module + '.configdata.DATA')
    model = miscmodels.helptopic()
    model.set_pattern('')
    qtmodeltester.data_display_may_return_none = True
    qtmodeltester.check(model)

    _check_completions(
        model, {
            "Commands": [
                (':drop', 'drop all user data', ''),
                (':hide', '', ''),
                (':roll', 'never gonna give you up', 'rr'),
                (':stop', 'stop qutebrowser', 's'),
            ],
            "Settings": [
                ('general->time', 'Is an illusion.', None),
                ('general->volume', 'Goes to 11', None),
                ('searchengines->DEFAULT', '', None),
                ('ui->gesture', 'Waggle your hands to control qutebrowser',
                 None),
                ('ui->mind', 'Enable mind-control ui (experimental)', None),
                ('ui->voice', 'Whether to respond to voice commands', None),
            ]
        })