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

Adapt more get_wordlist() tests to WordList.

WordLists should generally fullfill all promises of get_wordlist,
except closing file descriptors. The latter is not supported because
we might want to read a file several times.
parent ef123cd9
No related branches found
No related tags found
No related merge requests found
......@@ -255,3 +255,17 @@ class TestWordList(object):
assert long_list[0] == "a"
assert long_list[-1] == "@"
assert len(long_list) == 8192
def test_get_wordlist_simple(self, tmpdir):
# simple wordlists can be created
in_file = tmpdir.mkdir("work").join("mywordlist")
in_file.write("a\nb\n")
result = list(WordList(str(in_file)))
assert ['a', 'b'] == result
def test_get_wordlist_ignore_empty_lines(self, tmpdir):
# we ignore empty lines in wordlists
in_file = tmpdir.mkdir("work").join("mywordlist")
in_file.write("\n\na\n\n")
result = list(WordList(str(in_file)))
assert ['a'] == result
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