Refs #31375 -- Added test for contrib.auth.hashers.make_password() bytes support.

This commit is contained in:
Hasan Ramezani 2020-03-26 13:19:11 +01:00 committed by Mariusz Felisiak
parent 4b146e0c83
commit b3ab92cc5a
1 changed files with 6 additions and 0 deletions

View File

@ -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=')