def test_already_locked(self): key = uuid4() self.redis.setex(key, 10, '1') storage = RedisStorage(self.redis, expiry=10) assert not storage.obtain_lock(key, '1')
def test_lock_obtained_with_expiry(self): key = uuid4() storage = RedisStorage(self.redis, expiry=10) assert storage.obtain_lock(key, '1') assert self.redis.ttl(key) == 10
def test_lock_obtained(self): storage = RedisStorage(self.redis) assert storage.obtain_lock(uuid4(), '1')