From 77737295c34f475848dd9d12f8e416e1f9cb777a Mon Sep 17 00:00:00 2001 From: ulif <uli@gnufix.de> Date: Sun, 26 Jul 2015 14:24:14 +0200 Subject: [PATCH] Add tests for signed wordlists (empty line). --- tests/test_wordlist.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_wordlist.py b/tests/test_wordlist.py index 8ca7b6d..29776f7 100644 --- a/tests/test_wordlist.py +++ b/tests/test_wordlist.py @@ -70,6 +70,22 @@ class Test_GetSignedWordList(object): assert "a" == result[0] assert "@" == result[-1] + def test_get_signed_wordlist_ignore_empty_lines(self, tmpdir): + # we ignore empty lines in wordlists + in_path = os.path.join( + os.path.dirname(__file__), "sample_signed_wordlist.asc") + with open(in_path, 'r') as fd: + result = get_signed_wordlist(fd) + assert '' not in result + + def test_get_signed_wordlist_closes_fd(self, tmpdir): + # we close passed-in file descriptors + in_path = os.path.join( + os.path.dirname(__file__), "sample_signed_wordlist.asc") + with open(in_path, 'r') as fd: + get_signed_wordlist(fd) + assert fd.closed is True + class TestWordlistModule(object): -- GitLab