本文整理汇总了Python中pyon.net.endpoint.RPCRequestEndpointUnit.attach_channel方法的典型用法代码示例。如果您正苦于以下问题:Python RPCRequestEndpointUnit.attach_channel方法的具体用法?Python RPCRequestEndpointUnit.attach_channel怎么用?Python RPCRequestEndpointUnit.attach_channel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyon.net.endpoint.RPCRequestEndpointUnit
的用法示例。
在下文中一共展示了RPCRequestEndpointUnit.attach_channel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_endpoint_send_errors
# 需要导入模块: from pyon.net.endpoint import RPCRequestEndpointUnit [as 别名]
# 或者: from pyon.net.endpoint.RPCRequestEndpointUnit import attach_channel [as 别名]
def test_endpoint_send_errors(self):
errlist = [exception.BadRequest, exception.Unauthorized, exception.NotFound, exception.Timeout, exception.Conflict, exception.ServerError, exception.ServiceUnavailable]
for err in errlist:
e = RPCRequestEndpointUnit(interceptors={})
ch = self._setup_mock_channel(status_code=err.status_code, error_message=str(err.status_code))
e.attach_channel(ch)
self.assertRaises(err, e.send, {})
示例2: test_endpoint_send
# 需要导入模块: from pyon.net.endpoint import RPCRequestEndpointUnit [as 别名]
# 或者: from pyon.net.endpoint.RPCRequestEndpointUnit import attach_channel [as 别名]
def test_endpoint_send(self):
e = RPCRequestEndpointUnit(interceptors={})
ch = self._setup_mock_channel()
e.attach_channel(ch)
ret, heads = e.send("rpc call")
self.assertEquals(ret, 'bidirmsg') # we just get payload back due to success RPC code 200
e.close()