File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -422,6 +422,27 @@ def test_password(self):
422422 roundup .password .test_missing_crypt ()
423423 roundup .password .crypt = orig_crypt
424424
425+ def test_pbkdf2_unpack (self ):
426+ pbkdf2_unpack = roundup .password .pbkdf2_unpack
427+
428+ with self .assertRaises (roundup .password .PasswordValueError ) as ctx :
429+ pbkdf2_unpack ("fred$password" )
430+
431+ self .assertEqual (ctx .exception .args [0 ],
432+ 'invalid PBKDF2 hash (wrong number of separators)' )
433+
434+ with self .assertRaises (roundup .password .PasswordValueError ) as ctx :
435+ pbkdf2_unpack ("0200000$salt$password" )
436+
437+ self .assertEqual (ctx .exception .args [0 ],
438+ 'invalid PBKDF2 hash (zero-padded rounds)' )
439+
440+ with self .assertRaises (roundup .password .PasswordValueError ) as ctx :
441+ pbkdf2_unpack ("fred$salt$password" )
442+
443+ self .assertEqual (ctx .exception .args [0 ],
444+ 'invalid PBKDF2 hash (invalid rounds)' )
445+
425446 def test_pbkdf2_migrate_rounds (self ):
426447 '''Check that migration happens when number of rounds in
427448 config is larger than number of rounds in current password.
You can’t perform that action at this time.
0 commit comments