• R/O
  • SSH

MakePW: Commit

The main repository. Contains both Python and Javascript implementations.


Commit MetaInfo

Revision411c4460828d864b45455163a721f498d7359b47 (tree)
Time2019-04-08 04:41:53
AuthorEric Hopper <hopper@omni...>
CommiterEric Hopper

Log Message

Add test for word_data in makepw.

Change Summary

Incremental Difference

diff -r e04f5bd5aee1 -r 411c4460828d makepw_test.py
--- a/makepw_test.py Sun Apr 07 12:41:43 2019 -0700
+++ b/makepw_test.py Sun Apr 07 12:41:53 2019 -0700
@@ -168,3 +168,26 @@
168168 assert result == 'StickersCopOutdoorRapidsSon'
169169 result = makepw.gen_xkcd_pw(6, b'\ff'*32)
170170 assert result == 'StickersCopOutdoorRapidsSonArgue'
171+
172+
173+def test_word_data():
174+ import bz2
175+ import binascii
176+ data = binascii.a2b_base64(makepw.word_data)
177+ wl = bz2.decompress(data)
178+
179+
180+def test_against_github_wordlist():
181+ import bz2
182+ import binascii
183+ try:
184+ from urllib2 import urlopen as urlopen_
185+ import contextlib
186+ urlopen = lambda url: contextlib.closing(urlopen_(url))
187+ except ImportError:
188+ # Assume Python3
189+ from urllib.request import urlopen
190+ data = binascii.a2b_base64(makepw.word_data)
191+ wl = bz2.decompress(data)
192+ with urlopen('https://raw.githubusercontent.com/first20hours/google-10000-english/master/google-10000-english-no-swears.txt') as url_wl:
193+ assert wl == url_wl.read()
Show on old repository browser