4 from xkcdpass
import xkcd_password
6 WORDFILE
= 'xkcdpass/static/default.txt'
9 class XkcdPasswordTests(unittest
.TestCase
):
11 self
.wordlist_full
= xkcd_password
.generate_wordlist(
15 self
.wordlist_small
= xkcd_password
.generate_wordlist(
16 wordfile
='tests/test_list.txt',
19 def test_loadwordfile(self
):
20 self
.assertEquals(len(self
.wordlist_full
), 29612)
23 self
.assertNotIn("__$$$__", self
.wordlist_small
)
25 def test_acrostic(self
):
27 result
= xkcd_password
.generate_xkcdpassword(
30 self
.assertEquals("".join(map(lambda x
: x
[0], result
.split())), word
)
32 def test_commandlineCount(self
):
34 result
= subprocess
.check_output(
35 ["python", "xkcdpass/xkcd_password.py", "-w", WORDFILE
,
37 self
.assertTrue(result
.count(b
"\n"), count
)
41 result
= xkcd_password
.generate_xkcdpassword(
44 self
.assertIsNotNone(re
.match('([a-z]+(_|$))+', result
))
47 if __name__
== '__main__':
48 suite
= unittest
.TestLoader().loadTestsFromTestCase(XkcdPasswordTests
)
49 unittest
.TextTestRunner(verbosity
=2).run(suite
)