def test__sync_call_with_kwarg_rets(self): def async_func(*args, **kwargs): cbparam = kwargs.get('callback') cbparam(sup=sentinel.val, sup2=sentinel.val2) tp = AMQPTransport(Mock()) rv = tp._sync_call(async_func, 'callback') self.assertEquals(rv, {'sup': sentinel.val, 'sup2': sentinel.val2})
def test__sync_call_with_ret_value(self): def async_func(*args, **kwargs): cbparam = kwargs.get('callback') cbparam(sentinel.val) tp = AMQPTransport(Mock()) rv = tp._sync_call(async_func, 'callback') self.assertEquals(rv, sentinel.val)
def test__sync_call_no_ret_value(self): def async_func(*args, **kwargs): cbparam = kwargs.get('callback') cbparam() tp = AMQPTransport(Mock()) rv = tp._sync_call(async_func, 'callback') self.assertIsNone(rv)
def test__sync_call_with_normal_and_kwarg_rets(self): def async_func(*args, **kwargs): cbparam = kwargs.get('callback') cbparam(sentinel.arg, sup=sentinel.val, sup2=sentinel.val2) tp = AMQPTransport(Mock()) rv = tp._sync_call(async_func, 'callback') self.assertEquals(rv, (sentinel.arg, {'sup':sentinel.val, 'sup2':sentinel.val2}))
def test__sync_call_with_mult_rets(self): def async_func(*args, **kwargs): cbparam = kwargs.get('callback') cbparam(sentinel.val, sentinel.val2) tp = AMQPTransport(Mock()) rv = tp._sync_call(async_func, 'callback') self.assertEquals(rv, (sentinel.val, sentinel.val2))