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'])
def test_show_all(capsys, cleandir, show_expected, fake_db): """Tests show command when no specific funk is provided.""" show_cmd = commands.Show(None, color=False) show_cmd() expected = '{0}{1}{2}'.format( show_expected['multiline'], show_expected['T'], show_expected['TT'], ) captured = capsys.readouterr() assert captured.out == expected
def test_show_verbose(capsys, cleandir, fake_db, funk_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 funk_dict.values(): if '\n' not in cmd_string: count_no_newlines += 1 assert captured.out.count('unalias') == len(funk_dict)
def show_cmd(args, show_expected): """Builds and returns show command.""" cmd = commands.Show(args.args, color=args.color) cmd.expected = show_expected[args.args[0]] return cmd