Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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()
Exemplo n.º 4
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()
Exemplo n.º 5
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)
Exemplo n.º 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)