Skip to content
Snippets Groups Projects
Commit b222203c authored by ulif's avatar ulif
Browse files

Let main generate passphrases.

parent 9a0e2153
No related branches found
No related tags found
No related merge requests found
......@@ -77,3 +77,4 @@ def main(args=1):
if args is 1:
args = sys.argv[1:]
options = handle_options(args)
print(get_passphrase(wordnum=options.num))
......@@ -67,7 +67,7 @@ class TestDicewareModule(object):
options = handle_options([])
assert options.num == 6
def test_main(self, capsys):
def test_main_help(self, capsys):
# we can get help
with pytest.raises(SystemExit) as exc_info:
main(['diceware', '--help'])
......@@ -84,3 +84,12 @@ class TestDicewareModule(object):
' -h, --help show this help message and exit\n'
' -n NUM, --num NUM number of words to concatenate. Default: 6\n'
)
def test_main(self, capsys):
# we can get a passphrase
main([]) # call with default options in place
out, err = capsys.readouterr()
assert err == '' # we got no errors
assert out[-1] == '\n' # output ends with liebreak
assert not ('\n' in out[:-1]) # we get one line
assert len(out) > 5 # we get at least some chars
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment