def test_memcache_functions(app): """The (private) memcached functions correctly get, set, and invalidate a cached item using a mock cache""" with app.app_context(): tree = types.JsonTree(tree='t', status='o', reason='r', message_of_the_day='motd') eq_(treestatus.tree_cache_get(u't'), None) treestatus.tree_cache_set(u't', tree) eq_(treestatus.tree_cache_get(u't').status, 'o') treestatus.tree_cache_invalidate(u't') eq_(treestatus.tree_cache_get(u't'), None)
def test_memcache_no_config(app): """With no cache configured, the (private) memcached functions do nothing""" with app.app_context(): # always misses eq_(treestatus.tree_cache_get(u't'), None) # always succeed eq_(treestatus.tree_cache_set(u't', types.JsonTree()), None) eq_(treestatus.tree_cache_invalidate(u't'), None)