Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
diceware-debian
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drebs
diceware-debian
Commits
03ec0150
Commit
03ec0150
authored
9 years ago
by
ulif
Browse files
Options
Downloads
Patches
Plain Diff
Port signed wordlist tests to WordList testcase.
parent
3a02d070
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_wordlist.py
+25
-0
25 additions, 0 deletions
tests/test_wordlist.py
with
25 additions
and
0 deletions
tests/test_wordlist.py
+
25
−
0
View file @
03ec0150
...
...
@@ -269,3 +269,28 @@ class TestWordList(object):
in_file
.
write
(
"
\n\n
a
\n\n
"
)
result
=
list
(
WordList
(
str
(
in_file
)))
assert
[
'
a
'
]
==
result
def
test_get_signed_wordlist_handles_clearsigned_files
(
self
,
tmpdir
):
# we can process cryptogrphically signed files
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
[
"
foo
"
,
"
bar
"
,
"
-dash-at-start
"
,
"
baz
"
]
==
result
def
test_get_signed_wordlist_handles_en_orig
(
self
,
tmpdir
):
# we can process the original diceware list from diceware.com
wlist_path
=
os
.
path
.
join
(
WORDLISTS_DIR
,
'
wordlist_en_orig.asc
'
)
w_list
=
WordList
(
wlist_path
)
result
=
list
(
w_list
)
assert
len
(
result
)
==
7776
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
"
)
w_list
=
WordList
(
in_path
)
result
=
list
(
w_list
)
assert
''
not
in
result
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment