本文整理汇总了Python中pyon.net.endpoint.ListeningBaseEndpoint.create_endpoint方法的典型用法代码示例。如果您正苦于以下问题:Python ListeningBaseEndpoint.create_endpoint方法的具体用法?Python ListeningBaseEndpoint.create_endpoint怎么用?Python ListeningBaseEndpoint.create_endpoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyon.net.endpoint.ListeningBaseEndpoint
的用法示例。
在下文中一共展示了ListeningBaseEndpoint.create_endpoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_listen_exception_in_handling
# 需要导入模块: from pyon.net.endpoint import ListeningBaseEndpoint [as 别名]
# 或者: from pyon.net.endpoint.ListeningBaseEndpoint import create_endpoint [as 别名]
def test_listen_exception_in_handling(self):
# make a listen loop that will return one message (to blow up in processing)
chmock = MagicMock(spec=ListenChannel)
chmock.accept.return_value = Mock()
chmock.accept.return_value.recv = Mock(return_value=(sentinel.msg, sentinel.headers, sentinel.delivery_tag))
chmock.accept.return_value._recv_queue.qsize.return_value = 1
nodemock = Mock(spec=NodeB)
nodemock.channel.return_value = chmock
recv_name = NameTrio(sentinel.ex, sentinel.queue)
ep = ListeningBaseEndpoint(node=nodemock, from_name=recv_name)
# make msg received error out!
ep.create_endpoint = Mock(return_value=Mock(spec=EndpointUnit))
ep.create_endpoint.return_value._message_received.side_effect = TestError
ep.create_endpoint.return_value.intercept_in.return_value = (sentinel.msg, sentinel.headers)
self.assertRaises(TestError, ep.listen)
chmock.setup_listener.assert_called_once_with(recv_name, binding=sentinel.queue)
chmock.start_consume.assert_called_once_with()
chmock.accept.assert_called_once_with(n=1, timeout=None)
chmock.accept.return_value.recv.assert_called_once_with()
ep.create_endpoint.assert_called_once_with(existing_channel=chmock.accept.return_value)