Exemplo n.º 1
0
    def test_cast_interface_uses_default_options(self):
        """Test kombu rpc.cast"""

        ctxt = context.RequestContext('fake_user', 'fake_project')

        class MyConnection(impl_kombu.Connection):
            def __init__(myself, *args, **kwargs):
                super(MyConnection, myself).__init__(*args, **kwargs)
                self.assertEqual(
                    myself.params, {
                        'hostname': FLAGS.rabbit_host,
                        'userid': FLAGS.rabbit_userid,
                        'password': FLAGS.rabbit_password,
                        'port': FLAGS.rabbit_port,
                        'virtual_host': FLAGS.rabbit_virtual_host,
                        'transport': 'memory'
                    })

            def topic_send(_context, topic, msg):
                pass

        MyConnection.pool = rpc_amqp.Pool(FLAGS, MyConnection)
        self.stubs.Set(impl_kombu, 'Connection', MyConnection)

        impl_kombu.cast(FLAGS, ctxt, 'fake_topic', {'msg': 'fake'})
Exemplo n.º 2
0
    def test_cast_interface_uses_default_options(self):
        """Test kombu rpc.cast"""

        ctxt = context.RequestContext('fake_user', 'fake_project')

        class MyConnection(impl_kombu.Connection):
            def __init__(myself, *args, **kwargs):
                super(MyConnection, myself).__init__(*args, **kwargs)
                self.assertEqual(myself.params,
                        {'hostname': FLAGS.rabbit_host,
                         'userid': FLAGS.rabbit_userid,
                         'password': FLAGS.rabbit_password,
                         'port': FLAGS.rabbit_port,
                         'virtual_host': FLAGS.rabbit_virtual_host,
                         'transport': 'memory'})

            def topic_send(_context, topic, msg):
                pass

        MyConnection.pool = rpc_amqp.Pool(FLAGS, MyConnection)
        self.stubs.Set(impl_kombu, 'Connection', MyConnection)

        impl_kombu.cast(FLAGS, ctxt, 'fake_topic', {'msg': 'fake'})