コード例 #1
0
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)
コード例 #2
0
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)
コード例 #3
0
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)
コード例 #4
0
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)