def test_get(): bc = BlessCache(None, None, BlessCache.CACHEMODE_ENABLED) bc.cache = {'foo': 'bar'} assert bc.get('foo') == 'bar' assert bc.get('DOESNOTEXIST') is None
def test_load_cache(tmpdir): tmpdir.join('readcache_corrupted').write('{"foo": "bar"}}}') bc = BlessCache(str(tmpdir), 'readcache_corrupted', BlessCache.CACHEMODE_ENABLED) bar = bc.get('foo') assert bar == None
def test_get_nocache(): bc = BlessCache(None, None, BlessCache.CACHEMODE_DISABLED) bc.cache = {'foo': 'bar'} assert bc.get('foo') is None