def get_path(self, operation_info, http_method, url, service_name, type_dict, structure_dict, enum_dict, operation_id, error_map, enable_filtering): documentation = operation_info.documentation params = operation_info.params errors = operation_info.errors output = operation_info.output http_method = http_method.lower() par_array, url = self.handle_request_mapping( url, http_method, service_name, operation_id, params, type_dict, structure_dict, enum_dict, enable_filtering, rest_open_ph) response_map = rest_open_rh.populate_response_map( output, errors, error_map, type_dict, structure_dict, enum_dict, service_name, operation_id, enable_filtering) path_obj = utils.build_path(service_name, http_method, url, documentation, par_array, operation_id=operation_id, responses=response_map) utils.create_req_body_from_params_list(path_obj) self.post_process_path(path_obj) path = utils.add_basic_auth(path_obj) return path
def get_path(self, operation_info, http_method, url, service_name, type_dict, structure_dict, enum_dict, operation_id, http_error_map, enable_filtering): documentation = operation_info.documentation op_metadata = operation_info.metadata params = operation_info.params errors = operation_info.errors output = operation_info.output http_method = http_method.lower() consumes_json = self.find_consumes(http_method) produces = None par_array, url = self.handle_request_mapping( url, http_method, service_name, operation_id, params, type_dict, structure_dict, enum_dict, enable_filtering, api_swagg_ph) response_map = api_swagg_rh.populate_response_map( output, errors, http_error_map, type_dict, structure_dict, enum_dict, service_name, operation_id, op_metadata, enable_filtering) path_obj = utils.build_path(service_name, http_method, url, documentation, par_array, operation_id=operation_id, responses=response_map, consumes=consumes_json, produces=produces) self.post_process_path(path_obj) path = utils.add_basic_auth(path_obj) return path
def test_add_basic_auth(self): # check for adding security security attribute related to '/com/vmware/cis/session' path_obj = { 'tags': ['session'], 'method': 'post', 'path': '/com/vmware/cis/session', 'summary': 'mock documentation', 'responses': {'response code 1': {}, 'response code 2' : {} }, 'consumes': 'mock consumes', 'produces': 'mock produces', 'operationId': 'mock id', 'parameters': [{'mock params':'params 1'}] } path_obj_actual = utils.add_basic_auth(path_obj) path_obj_expected = { 'tags': ['session'], 'method': 'post', 'path': '/com/vmware/cis/session', 'summary': 'mock documentation', 'responses': {'response code 1': {}, 'response code 2' : {} }, 'consumes': 'mock consumes', 'produces': 'mock produces', 'operationId': 'mock id', 'security': [{'basic_auth': []}], 'parameters': [{'mock params':'params 1'}] } self.assertEqual(path_obj_expected, path_obj_actual)
def get_path(self, operation_info, http_method, url, service_name, type_dict, structure_dict, enum_dict, operation_id, http_error_map, show_unreleased_apis): documentation = operation_info.documentation op_metadata = operation_info.metadata params = operation_info.params errors = operation_info.errors output = operation_info.output http_method = http_method.lower() par_array, url = self.handle_request_mapping( url, http_method, service_name, operation_id, params, type_dict, structure_dict, enum_dict, show_unreleased_apis, api_swagg_ph) response_map = api_swagg_rh.populate_response_map( output, errors, http_error_map, type_dict, structure_dict, enum_dict, service_name, operation_id, op_metadata, show_unreleased_apis) path_obj = utils.build_path(service_name, http_method, url, documentation, par_array, operation_id=operation_id, responses=response_map) self.post_process_path(path_obj) path = utils.add_basic_auth(path_obj) return path
def get_path(self, operation_info, http_method, url, service_name, type_dict, structure_dict, enum_dict, operation_id, http_error_map, show_unreleased_apis): documentation = operation_info.documentation op_metadata = operation_info.metadata method_info = op_metadata[http_method] content_type = method_info.elements[ "consumes"].string_value if "consumes" in method_info.elements else None params = operation_info.params errors = operation_info.errors output = operation_info.output http_method = http_method.lower() par_array, url = self.handle_request_mapping( url, http_method, service_name, operation_id, params, content_type, type_dict, structure_dict, enum_dict, show_unreleased_apis, api_swagg_ph) response_map = api_swagg_rh.populate_response_map( output, errors, http_error_map, type_dict, structure_dict, enum_dict, service_name, operation_id, op_metadata, show_unreleased_apis) consumes = None if content_type == 'FORM_URLENCODED': consumes = ["application/x-www-form-urlencoded"] path_obj = utils.build_path(service_name, http_method, url, documentation, par_array, operation_id=operation_id, responses=response_map, consumes=consumes) self.post_process_path(path_obj) path = utils.add_basic_auth(path_obj) return path