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
6075a5e2
Commit
6075a5e2
authored
9 years ago
by
ulif
Browse files
Options
Downloads
Patches
Plain Diff
Support WordList.signed attribute.
parent
046332ed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
diceware/wordlist.py
+1
-0
1 addition, 0 deletions
diceware/wordlist.py
tests/test_wordlist.py
+15
-0
15 additions, 0 deletions
tests/test_wordlist.py
with
16 additions
and
0 deletions
diceware/wordlist.py
+
1
−
0
View file @
6075a5e2
...
...
@@ -152,3 +152,4 @@ class WordList(object):
self
.
fd
=
open
(
self
.
path
,
"
r
"
)
else
:
self
.
fd
=
path_or_filelike
self
.
signed
=
is_signed_wordlist
(
self
.
fd
)
This diff is collapsed.
Click to expand it.
tests/test_wordlist.py
+
15
−
0
View file @
6075a5e2
...
...
@@ -201,6 +201,7 @@ class TestWordList(object):
assert
w_list
is
not
None
assert
hasattr
(
w_list
,
"
path
"
)
assert
hasattr
(
w_list
,
"
fd
"
)
assert
hasattr
(
w_list
,
"
signed
"
)
def
test_create_opens_file
(
self
,
tmpdir
):
# if we pass-in a path, the file will be opened for reading.
...
...
@@ -217,3 +218,17 @@ class TestWordList(object):
w_list
=
WordList
(
my_open_file
)
assert
w_list
.
fd
is
not
None
assert
w_list
.
path
is
None
def
test_detect_unsigned_wordlists
(
self
,
tmpdir
):
# we can detect unsigned wordlist files.
in_file
=
tmpdir
.
mkdir
(
"
work
"
).
join
(
"
mywordlist
"
)
in_file
.
write
(
"
foo
\n
"
)
w_list
=
WordList
(
str
(
in_file
))
assert
w_list
.
signed
is
False
def
test_detec_signed_wordlists
(
self
):
# we can detect signed wordlist files.
in_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"
sample_signed_wordlist.asc
"
)
w_list
=
WordList
(
in_path
)
assert
w_list
.
signed
is
True
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