def _process_response(self, response): report = self._get_response_report(response) if report: self._report(report) return results = None target = response.request.target try: results = json.loads(response.data) except ValueError: self._report(reports.invalid_response_format(target.label)) return results = node_communication_format.response_to_result( results, self._response_key, list(self._action_definition.keys()), target.label ) for key, item_response in sorted(results.items()): if self._is_success(item_response): #only success process individually report = self._success_report( target.label, self._action_key_to_report(key), ) else: report = self._failure_report( target.label, self._action_key_to_report(key), node_communication_format.get_format_result( self._code_message_map )(item_response), **self._action_error_force ) self._report(report)
def _process_response(self, response): report = self._get_response_report(response) if report: self._report(report) return results = None target = response.request.target try: results = json.loads(response.data) except ValueError: self._report(reports.invalid_response_format(target.label)) return results = node_communication_format.response_to_result( results, self._response_key, list(self._action_definition.keys()), target.label) for key, item_response in sorted(results.items()): if self._is_success(item_response): #only success process individually report = self._success_report(target.label, key) else: report = self._failure_report( target.label, key, node_communication_format.get_format_result( self._code_message_map)(item_response), **self._action_error_force) self._report(report)
def assert_result_causes_invalid_format(self, result): assert_raise_library_error( lambda: node_communication_format.response_to_result( result, self.main_key, self.expected_keys, self.node_label, ), fixture_invalid_response_format(self.node_label))
def assert_result_causes_invalid_format(self, result): assert_raise_library_error( lambda: node_communication_format.response_to_result( result, self.main_key, self.expected_keys, self.node_label, ), fixture_invalid_response_format(self.node_label) )