Skip to content

Commit 9285808

Browse files
committed
Adds test to show a timeout of None can be provided and have the key not expire.
1 parent 7e1c308 commit 9285808

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/testapp/tests.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,13 @@ def test_expiration(self):
216216
self.assertEqual(self.cache.get("expire2"), "newvalue")
217217
self.assertEqual(self.cache.has_key("expire3"), False)
218218

219-
def test_set_expiration_timeout_None(self):
220-
key, value = self.cache.make_key('key'), 'value'
221-
self.cache.set(key, value)
222-
self.assertTrue(self.cache._client.ttl(key) > 0)
219+
def test_set_expiration_default_timeout(self):
220+
self.cache.set('a', 'a')
221+
self.assertTrue(self.cache._client.ttl(self.cache.make_key('a')) > 0)
222+
223+
def test_set_expiration_no_timeout(self):
224+
self.cache.set('a', 'a', timeout=None)
225+
self.assertTrue(self.cache._client.ttl(self.cache.make_key('a')) is None)
223226

224227
def test_set_expiration_timeout_zero(self):
225228
key, value = self.cache.make_key('key'), 'value'

0 commit comments

Comments
 (0)