diff --git a/tests/test_diceware.py b/tests/test_diceware.py index e63264f9a307f9520a4b7c39fc6f35e0bb04748d..7217591a3796d0602b40d24d7bb8dd3a5639c2b5 100644 --- a/tests/test_diceware.py +++ b/tests/test_diceware.py @@ -6,7 +6,7 @@ from io import StringIO from diceware import ( SRC_DIR, RE_LANG_CODE, SPECIAL_CHARS, get_wordlist, get_wordlist_path, insert_special_char, get_passphrase, - handle_options, main, + handle_options, main, __version__, ) @@ -195,6 +195,15 @@ class TestDicewareModule(object): expected_output = fd.read() assert out == expected_output + def test_main_version(self, argv_handler, capsys): + # we can get version infos. + sys.argv = ['diceware', '--version'] + with pytest.raises(SystemExit) as exc_info: + main() + assert exc_info.value.code == 0 + out, err = capsys.readouterr() + assert __version__ in out + def test_main_argv(self, argv_handler): # main() handles sys.argv if nothing is provided sys.argv = ['diceware', '--help']