def test_get(self):
     cache = File()
     cache.flush()
     cache['test'] = 'test'
     assert cache['test'] == 'test'
     assert cache.get('test') == 'test'
     assert cache.get('invalid', 'blah') == 'blah'
 def test_delete(self):
     cache = File()
     cache.flush()
     cache['test'] = 'test'
     assert cache['test'] == 'test'
     del cache['test']
     assert not cache['test']
Exemple #3
0
 def test_delete(self):
     cache = File()
     cache.flush()
     cache['test'] = 'test'
     assert cache['test'] == 'test'
     del cache['test']
     assert not cache['test']
 def test_set(self):
     cache = File()
     cache.flush()
     cache['test'] = 'test'
     cache.set('expired', 'value', -1)
     assert cache['test'] == 'test'
     assert not cache['expired']
Exemple #5
0
 def test_get(self):
     cache = File()
     cache.flush()
     cache['test'] = 'test'
     assert cache['test'] == 'test'
     assert cache.get('test') == 'test'
     assert cache.get('invalid', 'blah') == 'blah'
Exemple #6
0
 def test_set(self):
     cache = File()
     cache.flush()
     cache['test'] = 'test'
     cache.set('expired', 'value', -1)
     assert cache['test'] == 'test'
     assert not cache['expired']
 def test_expired(self):
     cache = File()
     cache.flush()
     cache.set('test', 'value', -1)
     assert cache.expired('test')
 def test_get_invalid(self):
     cache = File()
     cache.flush()
 def test_delete_invalid(self):
     cache = File()
     cache.flush()
     del cache['test']
Exemple #10
0
 def test_create_custom_config(self):
     cache = File({'dir': '/tmp'})
     assert repr(cache) == '<watson.cache.storage.File dir:/tmp>'
Exemple #11
0
 def test_contains(self):
     cache = File()
     cache.flush()
     assert not 'test' in cache
     cache['test'] = 'test'
     assert 'test' in cache
Exemple #12
0
 def test_expired(self):
     cache = File()
     cache.flush()
     cache.set('test', 'value', -1)
     assert cache.expired('test')
Exemple #13
0
 def test_get_invalid(self):
     cache = File()
     cache.flush()
Exemple #14
0
 def test_delete_invalid(self):
     cache = File()
     cache.flush()
     del cache['test']
Exemple #15
0
 def test_contains(self):
     cache = File()
     cache.flush()
     assert 'test' not in cache
     cache['test'] = 'test'
     assert 'test' in cache
Exemple #16
0
 def test_flush(self):
     cache = File()
     cache.flush()
     cache['test'] = 'test'
     assert cache.flush()
     assert not cache['test']
Exemple #17
0
 def test_flush(self):
     cache = File()
     cache.flush()
     cache['test'] = 'test'
     assert cache.flush()
     assert not cache['test']
Exemple #18
0
 def test_create(self):
     cache = File()
     assert repr(cache) == '<watson.cache.storage.File dir:{0}>'.format(
         gettempdir())