def test_simple_request( self ): request_data = tRequest( iface='test_iface', path=[TestModule.name, TestObject.class_name, '1'], command_id='echo', params=test_iface.get_request_params_type('echo')(test_param='hello'), request_id='001', ) pprint(tClientPacket, request_data) request = RequestBase.from_data(None, Peer(PhonyChannel()), self.iface_registry, request_data) response = self.server.process_request(request) pprint(tServerPacket, response.to_data()) self.assertEqual('hello to you too', response.result.test_result)
def make_tcp_transport_request( self, session_list, transport_id, obj_id, command_id, **kw ): request = tRequest( iface='test_iface', path=[TestModule.name, TestObject.class_name, obj_id], command_id=command_id, params=test_iface.get_request_params_type(command_id)(**kw), request_id='001', ) log.info('Sending request:') pprint(tClientPacket, request) request_packet = tPacket( aux_info=tAuxInfo(requirements=[], type_modules=[], modules=[], routes=[], resources=[]), payload=self.encode_packet(transport_id, request, tClientPacket)) request_packet_data = self.encode_packet(transport_id, request_packet, tPacket) transport_request = tTransportPacket( transport_id=transport_id, data=self.encrypt_packet(session_list, transport_id, request_packet_data)) return transport_request