'Test that cluster rename changes volumes and cgs.'

@mock.patch('cinder.db.sqlalchemy.api.volume_include_in_cluster', auto_specs=True, return_value=1)
@mock.patch('cinder.db.sqlalchemy.api.consistencygroup_include_in_cluster', auto_specs=True, return_value=2)
@mock.patch('cinder.context.get_admin_context')
def test_cluster_commands_rename(self, admin_ctxt_mock, volume_include_mock, cg_include_mock):

    current_cluster_name = mock.sentinel.old_cluster_name
    new_cluster_name = mock.sentinel.new_cluster_name
    partial = mock.sentinel.partial
    cluster_commands = cinder_manage.ClusterCommands()
    exit = cluster_commands.rename(partial, current_cluster_name, new_cluster_name)
    self.assertIsNone(exit)
    volume_include_mock.assert_called_once_with(admin_ctxt_mock.return_value, new_cluster_name, partial, cluster_name=current_cluster_name)
    cg_include_mock.assert_called_once_with(admin_ctxt_mock.return_value, new_cluster_name, partial, cluster_name=current_cluster_name)
