diff options
| author | Hasan Ramezani <hasan.r67@gmail.com> | 2020-03-26 13:23:32 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-03-31 10:52:56 +0200 |
| commit | 8aa71f4e8706b6b3e4e60aaffb29d004e1378ae3 (patch) | |
| tree | 9b8b61af27e03bc07a5ee4b95f380b525ff7c5df /tests | |
| parent | b3ab92cc5ad5e851692f36432465a9150e8b3313 (diff) | |
Fixed #31375 -- Made contrib.auth.hashers.make_password() accept only bytes or strings.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/auth_tests/test_hashers.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auth_tests/test_hashers.py b/tests/auth_tests/test_hashers.py index 7435569a7c..05be565fed 100644 --- a/tests/auth_tests/test_hashers.py +++ b/tests/auth_tests/test_hashers.py @@ -56,6 +56,11 @@ class TestUtilsHashPass(SimpleTestCase): self.assertIs(is_password_usable(encoded), True) self.assertIs(check_password(b'bytes_password', encoded), True) + def test_invalid_password(self): + msg = 'Password must be a string or bytes, got int.' + with self.assertRaisesMessage(TypeError, msg): + make_password(1) + def test_pbkdf2(self): encoded = make_password('lètmein', 'seasalt', 'pbkdf2_sha256') self.assertEqual(encoded, 'pbkdf2_sha256$216000$seasalt$youGZxOw6ZOcfrXv2i8/AhrnpZflJJ9EshS9XmUJTUg=') |
