summaryrefslogtreecommitdiff
path: root/tests/cache
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-03 11:13:39 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-07 11:57:14 +0200
commitec2f6ea9c6203524933e08d069733cd00a09ede3 (patch)
treea07ef16b718ffa961dfb31661f533515526652a9 /tests/cache
parent3921b1c6d24c9d5a60e5f5f83c9a394104089c21 (diff)
downloaddjango-ec2f6ea9c6203524933e08d069733cd00a09ede3.tar.gz
Refs #33060 -- Added memcached test for make_key() making keys invalid.
Diffstat (limited to 'tests/cache')
-rw-r--r--tests/cache/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index f2b70a4919..1b40def85a 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -1417,6 +1417,15 @@ class BaseMemcachedTests(BaseCacheTests):
getattr(cache, operation)(*args)
self.assertEqual(str(cm.exception), msg)
+ def test_invalid_with_version_key_length(self):
+ # make_key() adds a version to the key and exceeds the limit.
+ key = 'a' * 248
+ expected_warning = (
+ 'Cache key will cause errors if used with memcached: '
+ '%r (longer than %s)' % (key, 250)
+ )
+ self._perform_invalid_key_test(key, expected_warning)
+
def test_default_never_expiring_timeout(self):
# Regression test for #22845
with self.settings(CACHES=caches_setting_for_tests(