commit c34b30ddd5b4cc5a025a244686938daba1c3671d parent ac5f67ff73629a2d943182fb8cafda54afbda1db Author: Isak Lindhé <isak.e.lindhe@gmail.com> Date: Fri, 15 Feb 2019 08:40:10 +0100 tests for help and list Diffstat:
A | src/test.py | | | 35 | +++++++++++++++++++++++++++++++++++ |
1 file changed, 35 insertions(+), 0 deletions(-)
diff --git a/src/test.py b/src/test.py @@ -0,0 +1,35 @@ +from pytest import fixture + + +def test_help(capsys): + from txtv import cmd_help, commands + cmd_help() + cap = capsys.readouterr() + assert len(cap.out.splitlines()) == 1 + len([c for c in commands if 'help' in c]) # header + commands + assert len(cap.err) == 0 + + +def test_list(capsys): + import re + from txtv import cmd_list, Page + from colorama import Fore + cmd_list() + cap = capsys.readouterr() + assert len(cap.err) == 0 + lines = cap.out.splitlines() + for line in lines: + assert len(line) == len(lines[0]) + num = int(line[-len(Fore.RESET)-3:-len(Fore.RESET)]) + Page(num) + + +# def test_next(capsys): +# pass + + +# def test_prev(capsys): +# pass + + +# def test_goto(capsys): +# pass