MCPcopy
hub / github.com/django/django / test_bcrypt

Method test_bcrypt

tests/auth_tests/test_hashers.py:159–171  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

157 PASSWORD_HASHERS=["django.contrib.auth.hashers.BCryptPasswordHasher"]
158 )
159 def test_bcrypt(self):
160 encoded = make_password("lètmein", hasher="bcrypt")
161 self.assertTrue(is_password_usable(encoded))
162 self.assertTrue(encoded.startswith("bcrypt$"))
163 self.assertTrue(check_password("lètmein", encoded))
164 self.assertFalse(check_password("lètmeinz", encoded))
165 self.assertEqual(identify_hasher(encoded).algorithm, "bcrypt")
166 # Blank passwords
167 blank_encoded = make_password("", hasher="bcrypt")
168 self.assertTrue(blank_encoded.startswith("bcrypt$"))
169 self.assertTrue(is_password_usable(blank_encoded))
170 self.assertTrue(check_password("", blank_encoded))
171 self.assertFalse(check_password(" ", blank_encoded))
172
173 @skipUnless(bcrypt, "bcrypt not installed")
174 @override_settings(

Callers

nothing calls this directly

Calls 4

make_passwordFunction · 0.90
is_password_usableFunction · 0.90
check_passwordFunction · 0.90
identify_hasherFunction · 0.90

Tested by

no test coverage detected