Beispiel #1
0
 async def test_acquire_conn(self):
     redis = RedisBackend()
     pool = FakePool()
     redis._pool = pool
     with patch("aiocache.backends.redis.aioredis.create_pool",
                MagicMock(return_value=pool)):
         assert await redis.acquire_conn() == pool.conn
Beispiel #2
0
 async def test_release_conn(self):
     redis = RedisBackend()
     pool = FakePool()
     redis._pool = pool
     with patch("aiocache.backends.redis.aioredis.create_pool",
                MagicMock(return_value=pool)):
         conn = await redis.acquire_conn()
         await redis.release_conn(conn)
         redis._pool.release.assert_called_with(conn)
Beispiel #3
0
def redis(redis_pool):
    redis = RedisBackend()
    redis._pool = redis_pool
    yield redis