diff --git a/tests/test_wordlist.py b/tests/test_wordlist.py index 351ec592aabb6953ac643b282f6a672dda9b7ab5..1759171f3083ef4bb150e8d0ca0e4ef23535c9ab 100644 --- a/tests/test_wordlist.py +++ b/tests/test_wordlist.py @@ -219,6 +219,24 @@ class TestWordList(object): assert w_list.fd is not None assert w_list.path is None + def test_open_file_descriptor_simple(self, tmpdir): + # we handle simple lists from open file descriptors correctly + in_file = tmpdir.mkdir("work").join("mywordlist") + in_file.write("foo\nbar\n\nbaz\n") + with open(str(in_file), "r") as my_open_file: + w_list = WordList(my_open_file) + result = tuple(w_list) + assert result == ("foo", "bar", "baz") + + def test_open_file_descriptor_signed(self): + # we can handle signed wordlists from open file descriptors + in_path = os.path.join( + os.path.dirname(__file__), "sample_signed_wordlist.asc") + with open(str(in_path), "r") as my_open_file: + w_list = WordList(my_open_file) + result = tuple(w_list) + assert ("foo", "bar", "-dash-at-start", "baz") == result + def test_detect_unsigned_wordlists(self, tmpdir): # we can detect unsigned wordlist files. in_file = tmpdir.mkdir("work").join("mywordlist")