def i_request_the_creation_of_an_instance_of_an_environment_using_data(step, env_name): # First, send the request to get the environment on which the instance will be based env_name = dataset_utils.generate_fixed_length_param(env_name) world.env_requests.get_environment(env_name) assert world.response.status == 200,\ "Wrong status code received getting environment: %d. Expected: %d. Body content: %s"\ % (world.response.status, 200, world.response.read()) environment = environment_request.process_environment(json.loads(world.response.read())) # Then, create the instance data = dataset_utils.prepare_data(step.hashes[0]) instance = EnvironmentInstance(data.get(NAME), data.get(DESCRIPTION), environment) world.inst_requests.add_instance(instance)
def an_instance_of_the_environment_has_already_been_created_using_data(step, env_name): # First, send the request to get the environment on which the instance will be based env_name = dataset_utils.generate_fixed_length_param(env_name) world.env_requests.get_environment(env_name) assert world.response.status == 200,\ "Wrong status code received getting environment: %d. Expected: %d. Body content: %s"\ % (world.response.status, 200, world.response.read()) parsed_body = json.loads(world.response.read()) environment = environment_request.process_environment(parsed_body) # Then, create the instance data = dataset_utils.prepare_data(step.hashes[0]) instance = EnvironmentInstance(data.get(NAME), data.get(DESCRIPTION), environment) world.inst_requests.add_instance(instance) i_receive_a_response_of_type(step, 'OK') the_task_ends_with_status(step, 'SUCCESS')
def i_request_the_creation_of_an_instance_using_data(step): """ Create a product instance for the created environment and tiers """ # First, send the request to get the environment on which the instance will be based world.env_requests.get_environment(world.environment_name) body_env_response = raw_httplib_request_to_python_dic(world.response) assert_equal(world.response.status, 200, "Wrong status code received getting environment: %d. Expected: %d. Body content: %s" % (world.response.status, 200, body_env_response)) target_environment = process_environment(body_env_response) # Then, create the instance env_data = dataset_utils.prepare_data(step.hashes[0]) world.instance_name = env_data.get(NAME)+world.region_name.replace("_", "") environment_instance = EnvironmentInstance(world.instance_name, env_data.get(DESCRIPTION), target_environment) world.inst_requests.add_instance(environment_instance)
def i_request_the_creation_of_an_instance_using_data(step): """ Create a product instance for the created environment and tiers """ # First, send the request to get the environment on which the instance will be based world.env_requests.get_environment(world.environment_name) body_env_response = raw_httplib_request_to_python_dic(world.response) assert_equal( world.response.status, 200, "Wrong status code received getting environment: %d. Expected: %d. Body content: %s" % (world.response.status, 200, body_env_response)) target_environment = process_environment(body_env_response) # Then, create the instance env_data = dataset_utils.prepare_data(step.hashes[0]) world.instance_name = env_data.get(NAME) + world.region_name.replace( "_", "") environment_instance = EnvironmentInstance(world.instance_name, env_data.get(DESCRIPTION), target_environment) world.inst_requests.add_instance(environment_instance)