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

Use -w option value.

Activates the -w option. Turns out we still have to fix
`get_wordlist_path` at it assumes that wordlists all end in
``.txt`` (which is not true).
parent 73f833e6
Branches
Tags
No related merge requests found
......@@ -163,7 +163,7 @@ def get_passphrase(options=None):
if options is None:
options = handle_options(args=[])
if options.infile is None:
options.infile = open(get_wordlist_path("en_8k"), 'r')
options.infile = open(get_wordlist_path(options.wordlist), 'r')
word_list = WordList(options.infile)
rnd_source = get_random_sources()[options.randomsource]
rnd = rnd_source(options)
......
......@@ -265,3 +265,12 @@ class TestDicewareModule(object):
out, err = capsys.readouterr()
specials = [x for x in out if x in SPECIAL_CHARS]
assert len(specials) > 0
def test_main_wordlist(self, argv_handler, capsys, wordlists_dir):
# we can pick the wordlist we prefer
wordlists_dir.join('wordlist_foo.txt').write("foo\n")
wordlists_dir.join('wordlist_bar.asc').write("bar\n")
sys.argv = ['diceware', '-w', 'foo']
main()
out, err = capsys.readouterr()
assert out == 'FooFooFooFooFooFoo\n'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment