[4.0.x] Skipped scrypt tests when OpenSSL 1.1+ is not installed.

Backport of 3e928de8add92a5f38a562abd7560b023d24b6af from main
This commit is contained in:
HieuPham9720 2022-10-20 18:50:48 -07:00 committed by Mariusz Felisiak
parent 07ccf43544
commit d3ee881c8e

View File

@ -40,6 +40,14 @@ try:
except ImportError:
argon2 = None
# scrypt requires OpenSSL 1.1+
try:
import hashlib
scrypt = hashlib.scrypt
except ImportError:
scrypt = None
class PBKDF2SingleIterationHasher(PBKDF2PasswordHasher):
iterations = 1
@ -757,6 +765,7 @@ class TestUtilsHashPassArgon2(SimpleTestCase):
setattr(hasher, attr, old_value)
@skipUnless(scrypt, "scrypt not available")
@override_settings(PASSWORD_HASHERS=PASSWORD_HASHERS)
class TestUtilsHashPassScrypt(SimpleTestCase):
def test_scrypt(self):