@mock.patch.object(messaging, 'Target')
@mock.patch.object(cfg, 'CONF')
@mock.patch.object(rpc, 'get_server')
def test_create_consumer(self, mock_get, mock_cfg, mock_tgt):
    mock_cfg.host = 'foo'
    server = mock.Mock()
    target = mock.Mock()
    mock_get.return_value = server
    mock_tgt.return_value = target
    self.conn.create_consumer('topic', 'endpoints', fanout=True)
    mock_tgt.assert_called_once_with(topic='topic', server='foo', fanout=True)
    mock_get.assert_called_once_with(target, 'endpoints')
    self.assertEqual([server], self.conn.servers)
@mock.patch.object(messaging, 'Target')
@mock.patch.object(cfg, 'CONF')
@mock.patch.object(rpc, 'get_server')
def test_create_consumer(self, mock_get, mock_cfg, mock_tgt):
    mock_cfg.host = 'foo'
    server = mock.Mock()
    target = mock.Mock()
    mock_get.return_value = server
    mock_tgt.return_value = target
    self.conn.create_consumer('topic', 'endpoints', fanout=True)
    mock_tgt.assert_called_once_with(topic='topic', server='foo', fanout=True)
    mock_get.assert_called_once_with(target, 'endpoints')
    self.assertEqual([server], self.conn.servers)