def api_method_is_called(step, apiCall, nodeName): """ This is the general api calling function. There are 3 inputs :param apiCAll: The api call that will be requested :param nodeName: The name identifying the node you would like to make this request on :param table: A gherkin table outlining any arguments needed for the call (See tests/features/machine1/1_api+tests.feature for examples) The table parameter is unique in that there are several input types available depending on the call being made. :type string: Basic string argument, will be taken as is :type int: Basic integer argument, will be converted to int before call is made :type nodeAddress: Node name identifier, will create address from node configuration :type staticValue: Static name identifier, will fetch value from util/static_vals.py :type staticList: Same as staticValue, except it places the results into a list :type responseValue: Identifier for api call response value :type responseList: Same as responseValue, ecept it places the results into a list :type bool: Bool argument, returns True or False """ logger.info('%s is called on %s', apiCall, nodeName) world.config['apiCall'] = apiCall world.config['nodeId'] = nodeName arg_list = step.hashes options = {} api_utils.prepare_options(arg_list, options) api = api_utils.prepare_api_call(nodeName) response = api_utils.fetch_call(apiCall, api, options) assert type( response ) is dict, 'There may be something wrong with the response format: {}'.format( response) world.responses[apiCall] = {} world.responses[apiCall][nodeName] = response
def transactions_to_approve(node, arg_list): response = api_utils.fetch_call('getTransactionsToApprove', arg_list['api'], {'depth': 3}) arg_list['responses']['getTransactionsToApprove'][node] = response return response
def make_call(node, arg_list): response = api_utils.fetch_call(api_call, arg_list['api'], arg_list['options']) arg_list['responses'][api_call] = {} arg_list['responses'][api_call][node] = response return response
def run_call(node, args): logger.debug('Running Thread on {}'.format(node)) api = args['api'] options = args['options'] response = api_utils.fetch_call(api_call, api, options) return response