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