Exemple #1
0
def test_show_prefix(capsys, cleandir, fake_db, show_expected):
    """Tests show command when funk prefix is used."""
    cmd = commands.Show('T..')
    cmd()
    captured = capsys.readouterr()
    assert captured.out == '{}{}'.format(show_expected['T'],
                                         show_expected['TT'])
Exemple #2
0
def test_show_all(capsys, cleandir, _show_expected, fake_db):
    """Tests show command when no specific alias is provided."""
    show_cmd = commands.Show(None, color=False)
    show_cmd()
    expected = '{0}{1}\n{2}'.format(_show_expected['T'],
                                    _show_expected['TT'],
                                    _show_expected['multiline'])
    captured = capsys.readouterr()
    assert captured.out == expected
Exemple #3
0
def test_show_verbose(capsys, cleandir, fake_db, alias_dict):
    """Tests show command with verbose output."""
    cmd = commands.Show(None, verbose=True)
    cmd()
    captured = capsys.readouterr()

    count_no_newlines = 0
    for cmd_string in alias_dict.values():
        if '\n' not in cmd_string:
            count_no_newlines += 1

    assert captured.out.count('unalias') == len(alias_dict)
    assert captured.out.count('compdef') == count_no_newlines
Exemple #4
0
def show_cmd(args, show_expected):
    """Builds and returns show command."""
    cmd = commands.Show(args.alias, cmd_args=args.cmd_args, color=args.color)
    cmd.expected = show_expected[args.alias]
    return cmd