'Helper to submit rename form and check renaming result.
\'new_name\' should be a plain string, no formatting supported.'

def _do_test_rename(self, url, new_name, file_obj=None, folder_obj=None):

    if (file_obj is not None):
        checkbox_name = 'file-{}'.format(file_obj.id)
        files = [file_obj]
    elif (folder_obj is not None):
        checkbox_name = 'folder-{}'.format(folder_obj.id)
        files = File.objects.filter(folder=folder_obj)
    else:
        raise ValueError('file_obj    or    folder_obj    is    required')
    response = self.client.post(url, {'action': 'rename_files', 'post': 'yes', 'rename_format': new_name, helpers.ACTION_CHECKBOX_NAME: checkbox_name})
    self.assertEquals(response.status_code, 302)
    for f in files:
        f = f._meta.model.objects.get(pk=f.pk)
        self.assertEqual(f.name, new_name)
