def test_ctor(self): e = message.Publish(123456, u'com.myapp.topic1') msg = e.marshal() self.assertEqual(len(msg), 4) self.assertEqual(msg[0], message.Publish.MESSAGE_TYPE) self.assertEqual(msg[1], 123456) self.assertEqual(msg[2], {}) self.assertEqual(msg[3], u'com.myapp.topic1') e = message.Publish(123456, u'com.myapp.topic1', args = [1, 2, 3], kwargs = {u'foo': 23, u'bar': u'hello'}) msg = e.marshal() self.assertEqual(len(msg), 6) self.assertEqual(msg[0], message.Publish.MESSAGE_TYPE) self.assertEqual(msg[1], 123456) self.assertEqual(msg[2], {}) self.assertEqual(msg[3], u'com.myapp.topic1') self.assertEqual(msg[4], [1, 2, 3]) self.assertEqual(msg[5], {u'foo': 23, u'bar': u'hello'}) e = message.Publish(123456, u'com.myapp.topic1', excludeMe = False, exclude = [300], eligible = [100, 200, 300], discloseMe = True) msg = e.marshal() self.assertEqual(len(msg), 4) self.assertEqual(msg[0], message.Publish.MESSAGE_TYPE) self.assertEqual(msg[1], 123456) self.assertEqual(msg[2], {u'exclude_me': False, u'disclose_me': True, u'exclude': [300], u'eligible': [100, 200, 300]}) self.assertEqual(msg[3], u'com.myapp.topic1')
def publish(self, topic, *args, **kwargs): """ Implements :func:`autobahn.wamp.interfaces.IPublisher.publish` """ if six.PY2 and type(topic) == str: topic = six.u(topic) assert(type(topic) == six.text_type) if not self._transport: raise exception.TransportLost() request = util.id() if 'options' in kwargs and isinstance(kwargs['options'], types.PublishOptions): opts = kwargs.pop('options') msg = message.Publish(request, topic, args = args, kwargs = kwargs, **opts.options) else: opts = None msg = message.Publish(request, topic, args = args, kwargs = kwargs) if opts and opts.options['acknowledge'] == True: d = self._create_future() self._publish_reqs[request] = d, opts self._transport.send(msg) return d else: self._transport.send(msg) return
def generate_test_messages(): """ List of WAMP test message used for serializers. Expand this if you add more options or messages. This list of WAMP message does not contain any binary app payloads! """ msgs = [ message.Hello(u"realm1", {u'subscriber': role.RoleSubscriberFeatures()}), message.Goodbye(), message.Yield(123456), message.Yield(123456, args=[1, 2, 3], kwargs={u'foo': 23, u'bar': u'hello'}), message.Yield(123456, args=[u'hello']), message.Yield(123456, progress=True), message.Interrupt(123456), message.Interrupt(123456, mode=message.Interrupt.KILL), message.Invocation(123456, 789123), message.Invocation(123456, 789123, args=[1, 2, 3], kwargs={u'foo': 23, u'bar': u'hello'}), message.Invocation(123456, 789123, timeout=10000), message.Result(123456), message.Result(123456, args=[1, 2, 3], kwargs={u'foo': 23, u'bar': u'hello'}), message.Result(123456, progress=True), message.Cancel(123456), message.Cancel(123456, mode=message.Cancel.KILL), message.Call(123456, u'com.myapp.procedure1'), message.Call(123456, u'com.myapp.procedure1', args=[1, 2, 3], kwargs={u'foo': 23, u'bar': u'hello'}), message.Call(123456, u'com.myapp.procedure1', timeout=10000), message.Unregistered(123456), message.Unregister(123456, 789123), message.Registered(123456, 789123), message.Register(123456, u'com.myapp.procedure1'), message.Register(123456, u'com.myapp.procedure1', match=u'prefix'), message.Register(123456, u'com.myapp.procedure1', invoke=u'roundrobin'), message.Event(123456, 789123), message.Event(123456, 789123, args=[1, 2, 3], kwargs={u'foo': 23, u'bar': u'hello'}), message.Event(123456, 789123, publisher=300), message.Published(123456, 789123), message.Publish(123456, u'com.myapp.topic1'), message.Publish(123456, u'com.myapp.topic1', args=[1, 2, 3], kwargs={u'foo': 23, u'bar': u'hello'}), message.Publish(123456, u'com.myapp.topic1', exclude_me=False, exclude=[300], eligible=[100, 200, 300]), message.Unsubscribed(123456), message.Unsubscribe(123456, 789123), message.Subscribed(123456, 789123), message.Subscribe(123456, u'com.myapp.topic1'), message.Subscribe(123456, u'com.myapp.topic1', match=message.Subscribe.MATCH_PREFIX), message.Error(message.Call.MESSAGE_TYPE, 123456, u'com.myapp.error1'), message.Error(message.Call.MESSAGE_TYPE, 123456, u'com.myapp.error1', args=[1, 2, 3], kwargs={u'foo': 23, u'bar': u'hello'}), message.Call(123456, u'com.myapp.\u4f60\u597d\u4e16\u754c', args=[1, 2, 3]), message.Result(123456, args=[1, 2, 3], kwargs={u'en': u'Hello World', u'jp': u'\u3053\u3093\u306b\u3061\u306f\u4e16\u754c'}) ] return [(False, msg) for msg in msgs]
def publish(self, topic, *args, **kwargs): """ Implements :func:`autobahn.wamp.interfaces.IPublisher.publish` """ if six.PY2 and type(topic) == str: topic = six.u(topic) assert (type(topic) == six.text_type) if not self._transport: raise exception.TransportLost() request_id = self._request_id_gen.next() if 'options' in kwargs and isinstance(kwargs['options'], types.PublishOptions): options = kwargs.pop('options') msg = message.Publish(request_id, topic, args=args, kwargs=kwargs, **options.message_attr()) else: options = None msg = message.Publish(request_id, topic, args=args, kwargs=kwargs) if options and options.acknowledge: # only acknowledged publications expect a reply .. on_reply = txaio.create_future() self._publish_reqs[request_id] = PublishRequest( request_id, on_reply) else: on_reply = None try: # Notes: # # * this might raise autobahn.wamp.exception.SerializationError # when the user payload cannot be serialized # * we have to setup a PublishRequest() in _publish_reqs _before_ # calling transpor.send(), because a mock- or side-by-side transport # will immediately lead on an incoming WAMP message in onMessage() # self._transport.send(msg) except Exception as e: if request_id in self._publish_reqs: del self._publish_reqs[request_id] raise e return on_reply
def test_publish_traced_events(self): """ with two subscribers and message tracing the last event should have a magic flag """ # we want to trigger a deeply-nested condition in # processPublish in class Broker -- lets try w/o refactoring # anything first... class TestSession(ApplicationSession): pass session0 = TestSession() session1 = TestSession() session2 = TestSession() router = mock.MagicMock() router.send = mock.Mock() router.new_correlation_id = lambda: 'fake correlation id' router.is_traced = True broker = Broker(router, reactor) # let's just "cheat" our way a little to the right state by # injecting our subscription "directly" (e.g. instead of # faking out an entire Subscribe etc. flow # ...so we need _subscriptions_map to have at least one # subscription (our test one) for the topic we'll publish to broker._subscription_map.add_observer(session0, 'test.topic') broker._subscription_map.add_observer(session1, 'test.topic') session0._session_id = 1000 session0._transport = mock.MagicMock() session0._transport.get_channel_id = mock.MagicMock(return_value=b'deadbeef') session1._session_id = 1001 session1._transport = mock.MagicMock() session1._transport.get_channel_id = mock.MagicMock(return_value=b'deadbeef') session2._session_id = 1002 session2._transport = mock.MagicMock() session2._transport.get_channel_id = mock.MagicMock(return_value=b'deadbeef') # here's the main "cheat"; we're faking out the # router.authorize because we need it to callback immediately router.authorize = mock.MagicMock(return_value=txaio.create_future_success(dict(allow=True, cache=False, disclose=True))) # now we scan call "processPublish" such that we get to the # condition we're interested in (this "comes from" session1 # beacuse by default publishes don't go to the same session) pubmsg = message.Publish(123, 'test.topic') broker.processPublish(session2, pubmsg) # extract all the event calls events = [ call[1][1] for call in router.send.mock_calls if call[1][0] in [session0, session1, session2] ] self.assertEqual(2, len(events)) self.assertFalse(events[0].correlation_is_last) self.assertTrue(events[1].correlation_is_last)
def _publish(self, event, acknowledge=None): """ Given a MQTT event, create a WAMP Publish message and forward that on the forwarding WAMP session. """ try: payload_format, mapped_topic, options = yield self.factory.transform_mqtt( event.topic_name, event.payload) except: self.log.failure() return request = util.id() msg = message.Publish(request=request, topic=mapped_topic, exclude_me=False, acknowledge=acknowledge, retain=event.retain, **options) self._wamp_session.onMessage(msg) if event.qos_level > 0: self._request_to_packetid[request] = event.packet_identifier returnValue(0)
def test_basic(self): messages = [ message.Event(123456, 789123, args=[1, 2, 3], kwargs={'foo': 23, 'bar': 'hello'}, publisher=666, retained=True), message.Publish(123456, 'com.example.topic1', args=[1, 2, 3], kwargs={'foo': 23, 'bar': 'hello'}, retain=True) ] ser = serializer.FlatBuffersSerializer() # from pprint import pprint for msg in messages: # serialize message payload, binary = ser.serialize(msg) # unserialize message again msg2 = ser.unserialize(payload, binary)[0] # pprint(msg.marshal()) # pprint(msg2.marshal()) # must be equal: message roundtrips via the serializer self.assertEqual(msg, msg2)
def generate_test_messages(): return [ message.Hello(u"realm1", [role.RoleBrokerFeatures()]), message.Goodbye(), message.Heartbeat(123, 456), message.Yield(123456), message.Yield(123456, args = [1, 2, 3], kwargs = {u'foo': 23, u'bar': u'hello'}), message.Yield(123456, progress = True), message.Interrupt(123456), message.Interrupt(123456, mode = message.Interrupt.KILL), message.Invocation(123456, 789123), message.Invocation(123456, 789123, args = [1, 2, 3], kwargs = {u'foo': 23, u'bar': u'hello'}), message.Invocation(123456, 789123, timeout = 10000), message.Result(123456), message.Result(123456, args = [1, 2, 3], kwargs = {u'foo': 23, u'bar': u'hello'}), message.Result(123456, progress = True), message.Cancel(123456), message.Cancel(123456, mode = message.Cancel.KILL), message.Call(123456, u'com.myapp.procedure1'), message.Call(123456, u'com.myapp.procedure1', args = [1, 2, 3], kwargs = {u'foo': 23, u'bar': u'hello'}), message.Call(123456, u'com.myapp.procedure1', timeout = 10000), message.Unregistered(123456), message.Unregister(123456, 789123), message.Registered(123456, 789123), message.Register(123456, u'com.myapp.procedure1'), message.Register(123456, u'com.myapp.procedure1', pkeys = [10, 11, 12]), message.Event(123456, 789123), message.Event(123456, 789123, args = [1, 2, 3], kwargs = {u'foo': 23, u'bar': u'hello'}), message.Event(123456, 789123, publisher = 300), message.Published(123456, 789123), message.Publish(123456, u'com.myapp.topic1'), message.Publish(123456, u'com.myapp.topic1', args = [1, 2, 3], kwargs = {u'foo': 23, u'bar': u'hello'}), message.Publish(123456, u'com.myapp.topic1', excludeMe = False, exclude = [300], eligible = [100, 200, 300], discloseMe = True), message.Unsubscribed(123456), message.Unsubscribe(123456, 789123), message.Subscribed(123456, 789123), message.Subscribe(123456, u'com.myapp.topic1'), message.Subscribe(123456, u'com.myapp.topic1', match = message.Subscribe.MATCH_PREFIX), message.Error(message.Call.MESSAGE_TYPE, 123456, u'com.myapp.error1'), message.Error(message.Call.MESSAGE_TYPE, 123456, u'com.myapp.error1', args = [1, 2, 3], kwargs = {u'foo': 23, u'bar': u'hello'}), message.Call(123456, u'com.myapp.\u4f60\u597d\u4e16\u754c', args=[1, 2, 3]), message.Result(123456, args=[1, 2, 3], kwargs={u'en': u'Hello World', u'jp': u'\u3053\u3093\u306b\u3061\u306f\u4e16\u754c'}) ]
def test_publish_closed_session(self): """ ensure a session doesn't get Events if it's closed (see also issue #431) """ # we want to trigger a deeply-nested condition in # processPublish in class Broker -- lets try w/o refactoring # anything first... class TestSession(ApplicationSession): pass session0 = TestSession() session1 = TestSession() router = mock.MagicMock() router.new_correlation_id = lambda: 'fake correlation id' broker = Broker(router, reactor) # let's just "cheat" our way a little to the right state by # injecting our subscription "directly" (e.g. instead of # faking out an entire Subscribe etc. flow # ...so we need _subscriptions_map to have at least one # subscription (our test one) for the topic we'll publish to broker._subscription_map.add_observer(session0, 'test.topic') # simulate the session state we want, which is that a # transport is connected (._transport != None) but there # _session_id *is* None (not joined yet, or left already) self.assertIs(None, session0._session_id) session0._transport = mock.MagicMock() session0._transport.transport_details = TransportDetails( channel_id={'tls-unique': b'deadbeef'}) session1._session_id = 1234 # "from" session should look connected + joined session1._transport = mock.MagicMock() session1._transport.transport_details = TransportDetails( channel_id={'tls-unique': b'aaaabeef'}) # here's the main "cheat"; we're faking out the # router.authorize because we need it to callback immediately router.authorize = mock.MagicMock( return_value=txaio.create_future_success( dict(allow=True, cache=False, disclose=True))) # now we scan call "processPublish" such that we get to the # condition we're interested in (this "comes from" session1 # beacuse by default publishes don't go to the same session) pubmsg = message.Publish(123, 'test.topic') broker.processPublish(session1, pubmsg) # neither session should have sent anything on its transport self.assertEqual(session0._transport.method_calls, []) self.assertEqual(session1._transport.method_calls, [])
def session_add_testament(self, topic, args, kwargs, publish_options=None, scope=u"destroyed", details=None): """ Add a testament to the current session. :param topic: The topic to publish the testament to. :type topic: str :param args: A list of arguments for the publish. :type args: list or tuple :param kwargs: A dict of keyword arguments for the publish. :type kwargs: dict :param publish_options: The publish options for the publish. :type publish_options: None or dict :param scope: The scope of the testament, either "detached" or "destroyed". :type scope: str :returns: The publication ID. :rtype: int """ session = self._router._session_id_to_session[details.caller] if scope not in [u"destroyed", u"detached"]: raise ApplicationError(u"wamp.error.testament_error", u"scope must be destroyed or detached") pub_id = util.id() # Get the publish options, remove some explicit keys publish_options = publish_options or {} publish_options.pop("acknowledge", None) publish_options.pop("exclude_me", None) pub = message.Publish(request=pub_id, topic=topic, args=args, kwargs=kwargs, **publish_options) session._testaments[scope].append(pub) return pub_id
def _publish(self, event, options): request = util.id() msg = message.Publish(request=request, topic=u".".join( tokenise_mqtt_topic(event.topic_name)), payload=event.payload, **options.message_attr()) msg._mqtt_publish = True self._wamp_session.onMessage(msg) if event.qos_level > 0: self._request_to_packetid[request] = event.packet_identifier return succeed(0)
def onJoin(self, details): self._session_details = { 'authid': details.authid, 'authrole': details.authrole, 'authmethod': details.authmethod, 'realm': details.realm, 'session': details.session } ## FIXME: dispatch metaevent #self.publish('wamp.metaevent.session.on_join', evt) msg = message.Publish(0, u'wamp.metaevent.session.on_join', [self._session_details]) self._router.process(self, msg)
def onLeave(self, details): ## FIXME: dispatch metaevent #self.publish('wamp.metaevent.session.on_join', evt) msg = message.Publish(0, u'wamp.metaevent.session.on_leave', [self._session_details]) self._router.process(self, msg) self._session_details = None if details.reason == u"wamp.close.logout": if self._transport._cbtid and self._transport.factory._cookiestore: cs = self._transport.factory._cookiestore cs.setAuth(self._transport._cbtid, None, None, None) for proto in cs.getProtos(self._transport._cbtid): proto.sendClose()
def onJoin(self, details): self._session_details = { 'authid': details.authid, 'authrole': details.authrole, 'authmethod': details.authmethod, 'authprovider': details.authprovider, 'realm': details.realm, 'session': details.session, 'transport': self._transport._transport_info } ## dispatch session metaevent from WAMP AP ## msg = message.Publish(0, u'wamp.metaevent.session.on_join', [self._session_details]) self._router.process(self, msg)
def onLeave(self, details): ## dispatch session metaevent from WAMP AP ## msg = message.Publish(0, u'wamp.metaevent.session.on_leave', [self._session_details]) self._router.process(self, msg) self._session_details = None ## if asked to explicitly close the session .. if details.reason == u"wamp.close.logout": ## if cookie was set on transport .. if self._transport._cbtid and self._transport.factory._cookiestore: cs = self._transport.factory._cookiestore ## set cookie to "not authenticated" cs.setAuth(self._transport._cbtid, None, None, None) ## kick all session for the same auth cookie for proto in cs.getProtos(self._transport._cbtid): proto.sendClose()
def test_publish_traced_events_batched(self): """ with two subscribers and message tracing the last event should have a magic flag """ # we want to trigger a deeply-nested condition in # processPublish in class Broker -- lets try w/o refactoring # anything first... class TestSession(ApplicationSession): pass session0 = TestSession() session1 = TestSession() session2 = TestSession() session3 = TestSession() session4 = TestSession() # NOTE! We ensure that "session0" (the publishing session) is # *last* in the observation-list to trigger a (now fixed) # edge-case) sessions = [session1, session2, session3, session4, session0] router = mock.MagicMock() router.send = mock.Mock() router.new_correlation_id = lambda: 'fake correlation id' router.is_traced = True clock = Clock() with replace_loop(clock): broker = Broker(router, clock) broker._options.event_dispatching_chunk_size = 2 # to ensure we get "session0" last, we turn on ordering in # the observations broker._subscription_map._ordered = 1 # let's just "cheat" our way a little to the right state by # injecting our subscription "directly" (e.g. instead of # faking out an entire Subscribe etc. flow # ...so we need _subscriptions_map to have at least one # subscription (our test one) for the topic we'll publish to for session in sessions: broker._subscription_map.add_observer(session, 'test.topic') for i, sess in enumerate(sessions): sess._session_id = 1000 + i sess._transport = mock.MagicMock() sess._transport.get_channel_id = mock.MagicMock( return_value=b'deadbeef') # here's the main "cheat"; we're faking out the # router.authorize because we need it to callback immediately router.authorize = mock.MagicMock( return_value=txaio.create_future_success( dict(allow=True, cache=False, disclose=True))) # now we scan call "processPublish" such that we get to the # condition we're interested in; should go to all sessions # except session0 pubmsg = message.Publish(123, 'test.topic') broker.processPublish(session0, pubmsg) clock.advance(1) clock.advance(1) # extract all the event calls events = [ call[1][1] for call in router.send.mock_calls if call[1][0] in [session0, session1, session2, session3, session4] ] # all except session0 should have gotten an event, and # session4's should have the "last" flag set self.assertEqual(4, len(events)) self.assertFalse(events[0].correlation_is_last) self.assertFalse(events[1].correlation_is_last) self.assertFalse(events[2].correlation_is_last) self.assertTrue(events[3].correlation_is_last)
def generate_test_messages(): """ List of WAMP test message used for serializers. Expand this if you add more options or messages. This list of WAMP message does not contain any binary app payloads! """ some_bytes = os.urandom(32) some_unicode = '\u3053\u3093\u306b\u3061\u306f\u4e16\u754c' some_uri = 'com.myapp.foobar' some_unicode_uri = 'com.myapp.\u4f60\u597d\u4e16\u754c.baz' some_args = [1, 2, 3, 'hello', some_bytes, some_unicode, {'foo': 23, 'bar': 'hello', 'baz': some_bytes, 'moo': some_unicode}] some_kwargs = {'foo': 23, 'bar': 'hello', 'baz': some_bytes, 'moo': some_unicode, 'arr': some_args} msgs = [ message.Hello("realm1", {'subscriber': role.RoleSubscriberFeatures()}), message.Hello("realm1", {'publisher': role.RolePublisherFeatures()}), message.Hello("realm1", {'caller': role.RoleCallerFeatures()}), message.Hello("realm1", {'callee': role.RoleCalleeFeatures()}), message.Hello("realm1", { 'subscriber': role.RoleSubscriberFeatures(), 'publisher': role.RolePublisherFeatures(), 'caller': role.RoleCallerFeatures(), 'callee': role.RoleCalleeFeatures(), }), message.Goodbye(), message.Yield(123456), message.Yield(123456, args=some_args), message.Yield(123456, args=[], kwargs=some_kwargs), message.Yield(123456, args=some_args, kwargs=some_kwargs), message.Yield(123456, progress=True), message.Interrupt(123456), message.Interrupt(123456, mode=message.Interrupt.KILL), message.Invocation(123456, 789123), message.Invocation(123456, 789123, args=some_args), message.Invocation(123456, 789123, args=[], kwargs=some_kwargs), message.Invocation(123456, 789123, args=some_args, kwargs=some_kwargs), message.Invocation(123456, 789123, timeout=10000), message.Result(123456), message.Result(123456, args=some_args), message.Result(123456, args=[], kwargs=some_kwargs), message.Result(123456, args=some_args, kwargs=some_kwargs), message.Result(123456, progress=True), message.Cancel(123456), message.Cancel(123456, mode=message.Cancel.KILL), message.Call(123456, some_uri), message.Call(123456, some_uri, args=some_args), message.Call(123456, some_uri, args=[], kwargs=some_kwargs), message.Call(123456, some_uri, args=some_args, kwargs=some_kwargs), message.Call(123456, some_uri, timeout=10000), message.Call(123456, some_unicode_uri), message.Call(123456, some_unicode_uri, args=some_args), message.Call(123456, some_unicode_uri, args=[], kwargs=some_kwargs), message.Call(123456, some_unicode_uri, args=some_args, kwargs=some_kwargs), message.Call(123456, some_unicode_uri, timeout=10000), message.Unregistered(123456), message.Unregister(123456, 789123), message.Registered(123456, 789123), message.Register(123456, some_uri), message.Register(123456, some_uri, match='prefix'), message.Register(123456, some_uri, invoke='roundrobin'), message.Register(123456, some_unicode_uri), message.Register(123456, some_unicode_uri, match='prefix'), message.Register(123456, some_unicode_uri, invoke='roundrobin'), message.Event(123456, 789123), message.Event(123456, 789123, args=some_args), message.Event(123456, 789123, args=[], kwargs=some_kwargs), message.Event(123456, 789123, args=some_args, kwargs=some_kwargs), message.Event(123456, 789123, publisher=300), message.Published(123456, 789123), message.Publish(123456, some_uri), message.Publish(123456, some_uri, args=some_args), message.Publish(123456, some_uri, args=[], kwargs=some_kwargs), message.Publish(123456, some_uri, args=some_args, kwargs=some_kwargs), message.Publish(123456, some_uri, exclude_me=False, exclude=[300], eligible=[100, 200, 300]), message.Publish(123456, some_unicode_uri), message.Publish(123456, some_unicode_uri, args=some_args), message.Publish(123456, some_unicode_uri, args=[], kwargs=some_kwargs), message.Publish(123456, some_unicode_uri, args=some_args, kwargs=some_kwargs), message.Publish(123456, some_unicode_uri, exclude_me=False, exclude=[300], eligible=[100, 200, 300]), message.Unsubscribed(123456), message.Unsubscribe(123456, 789123), message.Subscribed(123456, 789123), message.Subscribe(123456, some_uri), message.Subscribe(123456, some_uri, match=message.Subscribe.MATCH_PREFIX), message.Subscribe(123456, some_unicode_uri), message.Subscribe(123456, some_unicode_uri, match=message.Subscribe.MATCH_PREFIX), message.Error(message.Call.MESSAGE_TYPE, 123456, some_uri), message.Error(message.Call.MESSAGE_TYPE, 123456, some_uri, args=some_args), message.Error(message.Call.MESSAGE_TYPE, 123456, some_uri, args=[], kwargs=some_kwargs), message.Error(message.Call.MESSAGE_TYPE, 123456, some_uri, args=some_args, kwargs=some_kwargs), message.Error(message.Call.MESSAGE_TYPE, 123456, some_unicode_uri), message.Error(message.Call.MESSAGE_TYPE, 123456, some_unicode_uri, args=some_args), message.Error(message.Call.MESSAGE_TYPE, 123456, some_unicode_uri, args=[], kwargs=some_kwargs), message.Error(message.Call.MESSAGE_TYPE, 123456, some_unicode_uri, args=some_args, kwargs=some_kwargs), message.Result(123456), message.Result(123456, args=some_args), message.Result(123456, args=some_args, kwargs=some_kwargs), ] return [(False, msg) for msg in msgs]