summaryrefslogtreecommitdiff
path: root/tests/auth_tests/test_hashers.py
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2020-03-26 13:19:11 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-03-31 10:49:39 +0200
commitb3ab92cc5ad5e851692f36432465a9150e8b3313 (patch)
tree513dc43213e84409b4adecf7fdd0f86af4bedf89 /tests/auth_tests/test_hashers.py
parent4b146e0c83891fc67a422aa22f846bb7654c4d38 (diff)
Refs #31375 -- Added test for contrib.auth.hashers.make_password() bytes support.
Diffstat (limited to 'tests/auth_tests/test_hashers.py')
-rw-r--r--tests/auth_tests/test_hashers.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auth_tests/test_hashers.py b/tests/auth_tests/test_hashers.py
index 754149dcea..7435569a7c 100644
--- a/tests/auth_tests/test_hashers.py
+++ b/tests/auth_tests/test_hashers.py
@@ -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=')