summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_crypto.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-01-13 22:33:42 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-01-14 17:50:04 +0100
commitbe6e46813010f47e3dec22dd8c360df2dcf53369 (patch)
tree91fbbe318edd44dbcf7fc241d827b8ab0477ac26 /tests/utils_tests/test_crypto.py
parentd992f4e3c29a81c956d3d616f0bc19701431b26e (diff)
Refs #31359 -- Made get_random_string()'s length argument required.
Per deprecation timeline.
Diffstat (limited to 'tests/utils_tests/test_crypto.py')
-rw-r--r--tests/utils_tests/test_crypto.py17
1 files changed, 2 insertions, 15 deletions
diff --git a/tests/utils_tests/test_crypto.py b/tests/utils_tests/test_crypto.py
index 4469d6e985..9dbfd9fe57 100644
--- a/tests/utils_tests/test_crypto.py
+++ b/tests/utils_tests/test_crypto.py
@@ -1,12 +1,10 @@
import hashlib
import unittest
-from django.test import SimpleTestCase, ignore_warnings
+from django.test import SimpleTestCase
from django.utils.crypto import (
- InvalidAlgorithm, constant_time_compare, get_random_string, pbkdf2,
- salted_hmac,
+ InvalidAlgorithm, constant_time_compare, pbkdf2, salted_hmac,
)
-from django.utils.deprecation import RemovedInDjango40Warning
class TestUtilsCryptoMisc(SimpleTestCase):
@@ -185,14 +183,3 @@ class TestUtilsCryptoPBKDF2(unittest.TestCase):
def test_default_hmac_alg(self):
kwargs = {'password': b'password', 'salt': b'salt', 'iterations': 1, 'dklen': 20}
self.assertEqual(pbkdf2(**kwargs), hashlib.pbkdf2_hmac(hash_name=hashlib.sha256().name, **kwargs))
-
-
-class DeprecationTests(SimpleTestCase):
- @ignore_warnings(category=RemovedInDjango40Warning)
- def test_get_random_string(self):
- self.assertEqual(len(get_random_string()), 12)
-
- def test_get_random_string_warning(self):
- msg = 'Not providing a length argument is deprecated.'
- with self.assertRaisesMessage(RemovedInDjango40Warning, msg):
- get_random_string()