def test_delegation_to_send_rpc_default_exchange(): conn = 'connection' ctx = 'context' topic = 'topic' method = 'foobar' args = 'args' msg = dict(method=method, args=args) timeout = 123 exchange = 'rpc' with mock.patch('nameko.legacy.nova.send_rpc', autospec=True) as send_rpc: nova.call(connection=conn, context=ctx, topic=topic, msg=msg, timeout=timeout) send_rpc.assert_called_with(conn, context=ctx, exchange=exchange, topic=topic, method=method, args=args, timeout=timeout)
def test_delegation_to_send_rpc(): conn = 'connection' ctx = 'context' topic = 'topic' method = 'foobar' args = 'args' msg = dict(method=method, args=args) timeout = 123 exchange = 'spam_exchange' options = {'CONTROL_EXCHANGE': exchange} with mock.patch('nameko.legacy.nova.send_rpc', autospec=True) as send_rpc: nova.call(connection=conn, context=ctx, topic=topic, msg=msg, timeout=timeout, options=options) send_rpc.assert_called_with(conn, context=ctx, exchange=exchange, topic=topic, method=method, args=args, timeout=timeout)
def test_delegation_to_send_rpc_default_exchange(): conn = 'connection' ctx = 'context' topic = 'topic' method = 'foobar' args = 'args' msg = dict(method=method, args=args) timeout = 123 exchange = 'rpc' with mock.patch('nameko.legacy.nova.send_rpc', autospec=True) as send_rpc: nova.call( connection=conn, context=ctx, topic=topic, msg=msg, timeout=timeout) send_rpc.assert_called_with( conn, context=ctx, exchange=exchange, topic=topic, method=method, args=args, timeout=timeout)
def test_delegation_to_send_rpc(): conn = 'connection' ctx = 'context' topic = 'topic' method = 'foobar' args = 'args' msg = dict(method=method, args=args) timeout = 123 exchange = 'spam_exchange' options = {'CONTROL_EXCHANGE': exchange} with mock.patch('nameko.legacy.nova.send_rpc', autospec=True) as send_rpc: nova.call( connection=conn, context=ctx, topic=topic, msg=msg, timeout=timeout, options=options) send_rpc.assert_called_with( conn, context=ctx, exchange=exchange, topic=topic, method=method, args=args, timeout=timeout)
def call(self, context=None, **kwargs): topic, method = self._get_route(kwargs) timeout = kwargs.pop('timeout', self.timeout) if context is None: context = self.context_factory() with self.create_connection() as connection: return nova.call( connection, context, topic, {'method': method, 'args': kwargs, }, timeout=timeout, options=self.call_options(), )
def call(self, context=None, **kwargs): topic, method = self._get_route(kwargs) timeout = kwargs.pop('timeout', self.timeout) if context is None: context = self.context_factory() with self.create_connection() as connection: return nova.call( connection, context, topic, { 'method': method, 'args': kwargs, }, timeout=timeout, options=self.call_options(), )