Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_initialization(self, redis_two_connections):
with patch("aioredlock.redis.Instance.__init__") as mock_instance:
mock_instance.return_value = None
redis = Redis(redis_two_connections)
calls = [
call({'host': 'localhost', 'port': 6379}),
call({'host': '127.0.0.1', 'port': 6378})
]
mock_instance.assert_has_calls(calls)
assert len(redis.instances) == 2
def mock_redis_three_instances(redis_three_connections):
pool = FakePool()
redis = Redis(redis_three_connections)
for instance in redis.instances:
instance._pool = pool
yield redis, pool
def mock_redis_two_instances(redis_two_connections):
pool = FakePool()
redis = Redis(redis_two_connections)
for instance in redis.instances:
instance._pool = pool
yield redis, pool
def __attrs_post_init__(self):
self.redis = Redis(self.redis_connections, self.lock_timeout)