summaryrefslogtreecommitdiff
path: root/tests/auth_tests/test_hashers.py
diff options
context:
space:
mode:
authorHieuPham9720 <44531309+HieuPham9720@users.noreply.github.com>2022-10-20 18:50:48 -0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-10-20 18:53:47 -0700
commitd3ee881c8ee523c78ddf25d6aa6d190c94bf70d5 (patch)
tree06d9d278ea47488c24a41d5ecdf19567b7d10cd2 /tests/auth_tests/test_hashers.py
parent07ccf435446634cbadcd2048b2dc8f3b69540e81 (diff)
[4.0.x] Skipped scrypt tests when OpenSSL 1.1+ is not installed.
Backport of 3e928de8add92a5f38a562abd7560b023d24b6af from main
Diffstat (limited to 'tests/auth_tests/test_hashers.py')
-rw-r--r--tests/auth_tests/test_hashers.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auth_tests/test_hashers.py b/tests/auth_tests/test_hashers.py
index 76144c19a0..52ef255b5a 100644
--- a/tests/auth_tests/test_hashers.py
+++ b/tests/auth_tests/test_hashers.py
@@ -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):