summaryrefslogtreecommitdiff
path: root/tests/cache
diff options
context:
space:
mode:
authorFlorian Apolloner <florian@apolloner.eu>2013-11-23 17:50:28 +0100
committerFlorian Apolloner <florian@apolloner.eu>2013-11-23 17:50:28 +0100
commite112654fc81ddb3fbffbb8382b004d69367a85fe (patch)
treee9f2ca209cf574ced866487533f3fd6fd577cda3 /tests/cache
parent0ec712dd1190f609d928bbaa1d635e692a75242b (diff)
Fixed #21200 -- Consistantly raise errors across all cache backends.
Thanks to tchaumeny for the patch.
Diffstat (limited to 'tests/cache')
-rw-r--r--tests/cache/tests.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index 0e512a6a41..b03c3494fc 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -48,6 +48,11 @@ class C:
return 24
+class Unpickable(object):
+ def __getstate__(self):
+ raise pickle.PickleError()
+
+
@override_settings(CACHES={
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
@@ -847,6 +852,16 @@ class BaseCacheTests(object):
self.assertEqual(get_cache_data.content, content.encode('utf-8'))
self.assertEqual(get_cache_data.cookies, response.cookies)
+ def test_add_fail_on_pickleerror(self):
+ "See https://code.djangoproject.com/ticket/21200"
+ with self.assertRaises(pickle.PickleError):
+ cache.add('unpickable', Unpickable())
+
+ def test_set_fail_on_pickleerror(self):
+ "See https://code.djangoproject.com/ticket/21200"
+ with self.assertRaises(pickle.PickleError):
+ cache.set('unpickable', Unpickable())
+
@override_settings(CACHES=caches_setting_for_tests(
BACKEND='django.core.cache.backends.db.DatabaseCache',