mirror of https://github.com/django/django.git
Refs #31375 -- Added test for contrib.auth.hashers.make_password() bytes support.
This commit is contained in:
parent
4b146e0c83
commit
b3ab92cc5a
|
@ -50,6 +50,12 @@ class TestUtilsHashPass(SimpleTestCase):
|
|||
self.assertTrue(check_password('', blank_encoded))
|
||||
self.assertFalse(check_password(' ', blank_encoded))
|
||||
|
||||
def test_bytes(self):
|
||||
encoded = make_password(b'bytes_password')
|
||||
self.assertTrue(encoded.startswith('pbkdf2_sha256$'))
|
||||
self.assertIs(is_password_usable(encoded), True)
|
||||
self.assertIs(check_password(b'bytes_password', encoded), True)
|
||||
|
||||
def test_pbkdf2(self):
|
||||
encoded = make_password('lètmein', 'seasalt', 'pbkdf2_sha256')
|
||||
self.assertEqual(encoded, 'pbkdf2_sha256$216000$seasalt$youGZxOw6ZOcfrXv2i8/AhrnpZflJJ9EshS9XmUJTUg=')
|
||||
|
|
Loading…
Reference in New Issue