Commit 9285808a authored by Sean Bleier's avatar Sean Bleier

Adds test to show a timeout of None can be provided and have the key not expire.

parent 7e1c3083
......@@ -216,10 +216,13 @@ class RedisCacheTests(TestCase):
self.assertEqual(self.cache.get("expire2"), "newvalue")
self.assertEqual(self.cache.has_key("expire3"), False)
def test_set_expiration_timeout_None(self):
key, value = self.cache.make_key('key'), 'value'
self.cache.set(key, value)
self.assertTrue(self.cache._client.ttl(key) > 0)
def test_set_expiration_default_timeout(self):
self.cache.set('a', 'a')
self.assertTrue(self.cache._client.ttl(self.cache.make_key('a')) > 0)
def test_set_expiration_no_timeout(self):
self.cache.set('a', 'a', timeout=None)
self.assertTrue(self.cache._client.ttl(self.cache.make_key('a')) is None)
def test_set_expiration_timeout_zero(self):
key, value = self.cache.make_key('key'), 'value'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment