summaryrefslogtreecommitdiff
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:51:58 -0700
commit2389c57f5d7b98c1da1c84ad71379d0df3db8b37 (patch)
treec0b6b388b9974f3bab711b524ecf970fb0c8261c
parent2611ecd5d981df17b1e150719c1bb16af85fce0a (diff)
[4.1.x] Skipped scrypt tests when OpenSSL 1.1+ is not installed.
Backport of 3e928de8add92a5f38a562abd7560b023d24b6af from main
-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 2faf2499b0..16882cefbf 100644
--- a/tests/auth_tests/test_hashers.py
+++ b/tests/auth_tests/test_hashers.py
@@ -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):