def test_publish_outbound(self): """ DummyDispatcher should have a fake outbound publisher that remembers messages. """ dispatcher = DummyDispatcher({ 'transport_names': ['ri_conn'], 'exposed_names': ['ro_conn'], }) self.assertEqual(dispatcher.transport_publisher['ri_conn'].msgs, []) dispatcher.publish_outbound_message('ri_conn', 'fake outbound') self.assertEqual( dispatcher.transport_publisher['ri_conn'].msgs, ['fake outbound']) dispatcher.transport_publisher['ri_conn'].clear() self.assertEqual(dispatcher.transport_publisher['ri_conn'].msgs, [])
def setUp(self): self.config = { 'transport_names': ['transport1'], 'exposed_names': ['app1', 'app2'], 'toaddr_mappings': { 'app1': 'to:.*:1', 'app2': 'to:app2', }, } self.dispatcher = DummyDispatcher(self.config) self.router = ToAddrRouter(self.dispatcher, self.config) yield self.router.setup_routing() self.msg_helper = self.add_helper(MessageHelper())
def setUp(self): config = { "transport_names": [ "transport_1", "transport_2", ], "exposed_names": ["round_robin"], "router_class": ("vumi.dispatchers.load_balancer." "LoadBalancingRouter"), } if self.reply_affinity is not None: config['reply_affinity'] = self.reply_affinity if self.rewrite_transport_names is not None: config['rewrite_transport_names'] = self.rewrite_transport_names self.dispatcher = DummyDispatcher(config) self.router = LoadBalancingRouter(self.dispatcher, config) self.add_cleanup(self.router.teardown_routing) yield self.router.setup_routing() self.msg_helper = self.add_helper(MessageHelper())
def setUp(self): config = { "transport_names": [ "transport_1", "transport_2", "transport_3", ], "exposed_names": ["muxed"], "router_class": "vumi.dispatchers.base.FromAddrMultiplexRouter", "fromaddr_mappings": { "thing1@muxme": "transport_1", "thing2@muxme": "transport_2", "thing3@muxme": "transport_3", }, } self.dispatcher = DummyDispatcher(config) self.router = FromAddrMultiplexRouter(self.dispatcher, config) self.add_cleanup(self.router.teardown_routing) yield self.router.setup_routing() self.msg_helper = self.add_helper(MessageHelper())