Show More
@@ -1,26 +1,27 b'' | |||
|
1 | 1 | # coding: utf-8 |
|
2 | 2 | from IPython.lib import passwd |
|
3 | 3 | from IPython.lib.security import passwd_check, salt_len |
|
4 | import nose.tools as nt | |
|
5 | 4 | |
|
6 | 5 | def test_passwd_structure(): |
|
7 |
p = passwd( |
|
|
8 |
algorithm, salt, hashed = p.split( |
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
6 | p = passwd("passphrase") | |
|
7 | algorithm, salt, hashed = p.split(":") | |
|
8 | assert algorithm == "sha1" | |
|
9 | assert len(salt) == salt_len | |
|
10 | assert len(hashed) == 40 | |
|
12 | 11 | |
|
13 | 12 | def test_roundtrip(): |
|
14 |
p = passwd( |
|
|
15 |
|
|
|
13 | p = passwd("passphrase") | |
|
14 | assert passwd_check(p, "passphrase") is True | |
|
15 | ||
|
16 | 16 | |
|
17 | 17 | def test_bad(): |
|
18 | 18 | p = passwd('passphrase') |
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
19 | assert passwd_check(p, p) is False | |
|
20 | assert passwd_check(p, "a:b:c:d") is False | |
|
21 | assert passwd_check(p, "a:b") is False | |
|
22 | ||
|
22 | 23 | |
|
23 | 24 | def test_passwd_check_unicode(): |
|
24 | 25 | # GH issue #4524 |
|
25 | 26 | phash = u'sha1:23862bc21dd3:7a415a95ae4580582e314072143d9c382c491e4f' |
|
26 | assert passwd_check(phash, u"łe¶ŧ←↓→") No newline at end of file | |
|
27 | assert passwd_check(phash, u"łe¶ŧ←↓→") |
General Comments 0
You need to be logged in to leave comments.
Login now