summaryrefslogtreecommitdiff
path: root/tests/regressiontests/cache
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-02-11 13:09:56 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-02-11 13:09:56 +0000
commit3792b2cd9f0c84f29ec4300eba7bd443452c4a25 (patch)
treec83137e1250c8b5c991d0b5fd509a03ebda88d8d /tests/regressiontests/cache
parentad08f077229450df0386bcab407f5953f3869fb8 (diff)
[1.1.X] Fixed #12399 -- Added handling for memcache timeouts longer than 30 days. Thanks to houdinihound for the report, and gciotta for the patch.
Backport of r12408 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12412 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/cache')
-rw-r--r--tests/regressiontests/cache/tests.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/regressiontests/cache/tests.py b/tests/regressiontests/cache/tests.py
index 593b7262aa..64f6130860 100644
--- a/tests/regressiontests/cache/tests.py
+++ b/tests/regressiontests/cache/tests.py
@@ -278,6 +278,22 @@ class BaseCacheTests(object):
self.cache.set(key, value)
self.assertEqual(self.cache.get(key), value)
+ def test_long_timeout(self):
+ '''
+ Using a timeout greater than 30 days makes memcached think
+ it is an absolute expiration timestamp instead of a relative
+ offset. Test that we honour this convention. Refs #12399.
+ '''
+ self.cache.set('key1', 'eggs', 60*60*24*30 + 1) #30 days + 1 second
+ self.assertEqual(self.cache.get('key1'), 'eggs')
+
+ self.cache.add('key2', 'ham', 60*60*24*30 + 1)
+ self.assertEqual(self.cache.get('key2'), 'ham')
+
+ self.cache.set_many({'key3': 'sausage', 'key4': 'lobster bisque'}, 60*60*24*30 + 1)
+ self.assertEqual(self.cache.get('key3'), 'sausage')
+ self.assertEqual(self.cache.get('key4'), 'lobster bisque')
+
class DBCacheTests(unittest.TestCase, BaseCacheTests):
def setUp(self):
management.call_command('createcachetable', 'test_cache_table', verbosity=0, interactive=False)