def _communication_to_response( label, dest_list, action, param_list, response_code, output, debug_output, was_connected, errno, error_msg, raw_data, ): return Response( MockCurlSimple( info={pycurl.RESPONSE_CODE: response_code}, output=output, debug_output=debug_output, request=Request( # We do not need to check if token is the right one in tests: # 1) Library commands tests do not care about tokens. That # should be covered once in a specialized test, not in every # single library command test. # 2) If we need to test teh case when a token is not accepted # by pcsd, we will do so by setting an appropriate response. # The actual token value doesn't matter. RequestTarget(label, dest_list=dest_list, token=None), RequestData(action, param_list, raw_data), ), ), was_connected=was_connected, errno=errno, error_msg=error_msg, )
def __communication_to_response(self, label, address_list, action, param_list, port, token, response_code, output, debug_output, was_connected, errno, error_msg): return Response( MockCurlSimple(info={pycurl.RESPONSE_CODE: response_code}, output=output.encode("utf-8"), debug_output=debug_output.encode("utf-8"), request=Request( RequestTarget(label, address_list, port, token), RequestData(action, param_list), )), was_connected=was_connected, errno=6, error_msg=error_msg, )