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']
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']
def test_create_custom_config(self): cache = File({'dir': '/tmp'}) assert repr(cache) == '<watson.cache.storage.File dir:/tmp>'
def test_contains(self): cache = File() cache.flush() assert not 'test' in cache cache['test'] = 'test' assert 'test' in cache
def test_contains(self): cache = File() cache.flush() assert 'test' not in cache cache['test'] = 'test' assert 'test' in cache
def test_flush(self): cache = File() cache.flush() cache['test'] = 'test' assert cache.flush() assert not cache['test']
def test_create(self): cache = File() assert repr(cache) == '<watson.cache.storage.File dir:{0}>'.format( gettempdir())