3
3
"""
4
4
5
5
6
- from django .conf import settings
7
6
from django .core .cache import caches
8
- from django .test import TestCase , override_settings
7
+ from django .test import TestCase
9
8
10
9
from common .djangoapps .util .memcache import safe_key
11
10
12
- BLAKE2B_ENABLED_FEATURES = settings .FEATURES .copy ()
13
- BLAKE2B_ENABLED_FEATURES ["ENABLE_BLAKE2B_HASHING" ] = True
14
-
15
11
16
12
class MemcacheTest (TestCase ):
17
13
"""
@@ -55,20 +51,6 @@ def test_safe_key_long(self):
55
51
# The key should now be valid
56
52
assert self ._is_valid_key (key ), f'Failed for key length { length } '
57
53
58
- @override_settings (FEATURES = BLAKE2B_ENABLED_FEATURES )
59
- def test_safe_key_long_with_blake2b_enabled (self ):
60
- # Choose lengths close to memcached's cutoff (250)
61
- for length in [248 , 249 , 250 , 251 , 252 ]:
62
-
63
- # Generate a key of that length
64
- key = 'a' * length
65
-
66
- # Make the key safe
67
- key = safe_key (key , '' , '' )
68
-
69
- # The key should now be valid
70
- assert self ._is_valid_key (key ), f'Failed for key length { length } '
71
-
72
54
def test_long_key_prefix_version (self ):
73
55
74
56
# Long key
@@ -83,34 +65,6 @@ def test_long_key_prefix_version(self):
83
65
key = safe_key ('key' , 'prefix' , 'a' * 300 )
84
66
assert self ._is_valid_key (key )
85
67
86
- @override_settings (FEATURES = BLAKE2B_ENABLED_FEATURES )
87
- def test_long_key_prefix_version_with_blake2b_enabled (self ):
88
-
89
- # Long key
90
- key = safe_key ('a' * 300 , 'prefix' , 'version' )
91
- assert self ._is_valid_key (key )
92
-
93
- # Long prefix
94
- key = safe_key ('key' , 'a' * 300 , 'version' )
95
- assert self ._is_valid_key (key )
96
-
97
- # Long version
98
- key = safe_key ('key' , 'prefix' , 'a' * 300 )
99
- assert self ._is_valid_key (key )
100
-
101
- def test_safe_key_unicode (self ):
102
-
103
- for unicode_char in self .UNICODE_CHAR_CODES :
104
-
105
- # Generate a key with that character
106
- key = chr (unicode_char )
107
-
108
- # Make the key safe
109
- key = safe_key (key , '' , '' )
110
-
111
- # The key should now be valid
112
- assert self ._is_valid_key (key ), f'Failed for unicode character { unicode_char } '
113
-
114
68
def test_safe_key_prefix_unicode (self ):
115
69
116
70
for unicode_char in self .UNICODE_CHAR_CODES :
0 commit comments