Esempio n. 1
0
 def test_data_expires_after_ttl(self):
     cache = resources.RamCache()
     cache.put('a', 'b', 10)
     utils.set_utcnow_for_test(9.99)
     assert cache.get('a') == 'b'
     utils.set_utcnow_for_test(10.01)
     assert cache.get('a') is None
Esempio n. 2
0
 def test_clear(self):
     cache = resources.RamCache()
     cache.put('a', 'b', 1)
     assert cache.get('a') == 'b'
     cache.clear()
     assert cache.get('a') is None
Esempio n. 3
0
 def test_ttl_zero_not_cached(self):
     cache = resources.RamCache()
     cache.put('a', 'b', 0)
     assert cache.get('a') is None
Esempio n. 4
0
 def test_data_is_cached(self):
     cache = resources.RamCache()
     cache.put('a', 'b', 1)
     assert cache.get('a') == 'b'