def check_dni(main_url, check_dni_uri, dni_uri, dni): ''' Check that the value inserted it's the dni and return the next endpoint ''' result_url = main_url + check_dni_uri next_endpoint = get_request(result_url, 'next')[0] result_url = main_url + dni_uri dni_val = get_request(result_url, 'value')[0] print("Original DNI:{} \nDNI in the backend:{}".format(dni, dni_val)) return next_endpoint
def get_dni_endpoint(main_url, endpoint): ''' make a petition to the endpoint and return the dni endpoint to insert your dni_uri ''' result_url = main_url + endpoint return get_request(result_url, 'next', 'uri', 'value')
def catch_second_operand(url, next_op): ''' Get the second operand of the calculation''' op2_url = url + next_op return get_request(op2_url, 'value', 'next')
def catch_first_operand(url): ''' Get the first operand of the calculation''' op1_url = url + "/step1" return get_request(op1_url, 'value', 'next')
def get_calc_value(main_url, endpoint, result): ''' Check that the result introduced is correct''' result_url = main_url + endpoint result_given = get_request(result_url, 'value')[0] print("Original result:{}".format(result)) print("Obtained result: {}".format(result_given))
def catch_operator(url, next_op): ''' Get the operator of the calculation''' operator_url = url + next_op return get_request(operator_url, 'value', 'next', 'uri')
def get_options_url(main_url, endpoint): ''' get the url to send the OPTIONS request ''' result_url = main_url + endpoint return get_request(result_url, 'next', 'uri')
def final_step(main_url, endpoint): ''' final request ''' result_url = main_url + endpoint get_request(result_url)
def check_options_value(main_url, endpoint, value): ''' Check that the value has been inserted ''' result_url = main_url + endpoint obtained_value = get_request(result_url, 'value')[0] print("Initial value:{}".format(value)) print("Obtained value:{}".format(obtained_value))
def obtain_the_value_from_the_endpoint(main_url, endpoint): ''' Checks the endpoint and gets the list and the following endpoints ''' result_url = main_url + endpoint return get_request(result_url, 'uri', 'value', 'next')
def check_that_the_value_has_been_removed(main_url, uri, value): ''' the function title ''' result_url = main_url + uri obtained_list = get_request(result_url, 'value')[0] print("Initial value:{}".format(value)) print("Obtained value:{}".format(obtained_list))
def request_the_next_step(main_url, next_uri): ''' Obtain the next step ''' result_url = main_url + next_uri return get_request(result_url, 'next')