Beispiel #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)
Beispiel #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)
Beispiel #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()
Beispiel #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()
Beispiel #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)
Beispiel #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)