def stored_request_real(redis_client): new_req = AcquisitionRequest(**TEST_ACQUISITION_REQ_JSON) new_req.timestamps['VALIDATED'] = 1449523225 redis_client.hset( AcquisitionRequestStore.REDIS_HASH_NAME, AcquisitionRequestStore.get_request_redis_id(TEST_ACQUISITION_REQ), str(new_req)) return new_req
def test_delete(req_store_real, redis_client, stored_request_real): req_store_real.delete(TEST_ACQUISITION_REQ) assert not redis_client.hexists( AcquisitionRequestStore.REDIS_HASH_NAME, AcquisitionRequestStore.get_request_redis_id(TEST_ACQUISITION_REQ))
def test_put(req_store, redis_mock): req_store.put(TEST_ACQUISITION_REQ) redis_mock.hset.assert_called_with( AcquisitionRequestStore.REDIS_HASH_NAME, AcquisitionRequestStore.get_request_redis_id(TEST_ACQUISITION_REQ), TEST_ACQUISITION_REQ_STR)
def req_store(redis_mock): return AcquisitionRequestStore(redis_mock)
def req_store_real(redis_client): return AcquisitionRequestStore(redis_client)