mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #31654 -- Fixed cache key validation messages.
This commit is contained in:
parent
f83b44075d
commit
926148ef01
5 changed files with 21 additions and 4 deletions
6
tests/cache/tests.py
vendored
6
tests/cache/tests.py
vendored
|
@ -637,8 +637,9 @@ class BaseCacheTests:
|
|||
cache.key_func = func
|
||||
|
||||
try:
|
||||
with self.assertWarnsMessage(CacheKeyWarning, expected_warning):
|
||||
with self.assertWarns(CacheKeyWarning) as cm:
|
||||
cache.set(key, 'value')
|
||||
self.assertEqual(str(cm.warning), expected_warning)
|
||||
finally:
|
||||
cache.key_func = old_func
|
||||
|
||||
|
@ -1276,8 +1277,9 @@ class BaseMemcachedTests(BaseCacheTests):
|
|||
key.
|
||||
"""
|
||||
msg = expected_warning.replace(key, cache.make_key(key))
|
||||
with self.assertRaisesMessage(InvalidCacheKey, msg):
|
||||
with self.assertRaises(InvalidCacheKey) as cm:
|
||||
cache.set(key, 'value')
|
||||
self.assertEqual(str(cm.exception), msg)
|
||||
|
||||
def test_default_never_expiring_timeout(self):
|
||||
# Regression test for #22845
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue