示例#1
0
    def test_endpoint_send_with_timeout(self):
        e = RequestEndpointUnit()
        e._recv_greenlet = sentinel.recv_greenlet
        e.channel = Mock()

        self.assertRaises(exception.Timeout,
                          e._send,
                          sentinel.msg,
                          Mock(),
                          timeout=1)
示例#2
0
    def test_endpoint_send_with_timeout(self):
        e = RequestEndpointUnit()
        e.channel = Mock()
        e.channel.recv = lambda: sleep(
            5)  # simulate blocking when recv is called

        self.assertRaises(exception.Timeout,
                          e._send,
                          sentinel.msg,
                          MagicMock(),
                          timeout=1)
示例#3
0
    def test_endpoint_send(self):
        e = RequestEndpointUnit(interceptors={})
        ch = self._setup_mock_channel()
        e.attach_channel(ch)

        retval, heads = e.send("msg")
        self.assertEquals(retval, "bidirmsg")

        # cleanup
        e.close()
示例#4
0
文件: test_endpoint.py 项目: daf/pyon
    def test_endpoint_send(self):
        e = RequestEndpointUnit(interceptors={})
        ch = self._setup_mock_channel()
        e.attach_channel(ch)

        retval, heads = e.send("msg")
        self.assertEquals(retval, "bidirmsg")

        # cleanup
        e.close()
示例#5
0
文件: test_endpoint.py 项目: daf/pyon
    def test_endpoint_send_with_timeout(self):
        e = RequestEndpointUnit()
        e.channel = Mock()
        e.channel.recv = lambda: sleep(5)   # simulate blocking when recv is called

        self.assertRaises(exception.Timeout, e._send, sentinel.msg, MagicMock(), timeout=1)
示例#6
0
    def test_endpoint_send_with_timeout(self):
        e = RequestEndpointUnit()
        e._recv_greenlet = sentinel.recv_greenlet
        e.channel = Mock()

        self.assertRaises(exception.Timeout, e._send, sentinel.msg, sentinel.headers, timeout=1)