Пример #1
0
    async def test_connect_pool_already_created(self):
        with patch("aioredis.create_pool") as create_pool:
            instance = Instance('localhost', 6379)
            fake_pool = FakePool()
            instance._pool = fake_pool

            pool = await instance.connect()

            assert not create_pool.called
            assert pool is fake_pool
Пример #2
0
    async def test_connect_pool_already_created(self):

        with patch('aioredlock.redis.Instance._create_redis_pool') as \
                create_redis_pool:
            instance = Instance(('localhost', 6379))
            fake_pool = FakePool()
            instance._pool = fake_pool

            pool = await instance.connect()

            assert not create_redis_pool.called
            assert pool is fake_pool
            assert pool.script_load.called is False