1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

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

Backport of 3e928de8ad from main
This commit is contained in:
HieuPham9720
2022-10-20 18:50:48 -07:00
committed by Mariusz Felisiak
parent 2611ecd5d9
commit 2389c57f5d

View File

@@ -42,6 +42,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
@@ -771,6 +779,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):