Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def test_is_locked(self, lock_manager_redis_patched, locked_lock, by_resource, locked):
lock_manager, redis = lock_manager_redis_patched
redis.is_locked.return_value = locked
Lock.valid = locked
resource = locked_lock.resource
resource_or_lock = resource if by_resource else locked_lock
res = await lock_manager.is_locked(resource_or_lock)
assert res == locked
redis.is_locked.assert_called_once_with(resource)