def test_touch_and_exists(self): target = RedisTarget(HOST, PORT, DB, 'update_id', PASSWORD) target.marker_prefix = MARKER_PREFIX flush() self.assertFalse(target.exists(), 'Target should not exist before touching it') target.touch() self.assertTrue(target.exists(), 'Target should exist after touching it') flush()
def test_expiration(self): target = RedisTarget( HOST, PORT, DB, 'update_id', PASSWORD, None, EXPIRE) target.marker_prefix = MARKER_PREFIX flush() target.touch() self.assertTrue(target.exists(), 'Target should exist after touching it and before expiring') sleep(EXPIRE) self.assertFalse(target.exists(), 'Target should not exist after expiring') flush()
def test_expiration(self): target = RedisTarget(HOST, PORT, DB, 'update_id', PASSWORD, None, EXPIRE) target.marker_prefix = MARKER_PREFIX flush() target.touch() self.assertTrue( target.exists(), 'Target should exist after touching it and before expiring') sleep(EXPIRE) self.assertFalse(target.exists(), 'Target should not exist after expiring') flush()