'Test the creation of folders, duplicate folders and sub folders'

def test_folder_operations(self):

    self.check_setup()
    name = u'zzz-test-folder'
    folder = self.dev.create_folder(self.storage, name)
    self.cleanup.append(folder)
    self.assertTrue(folder.is_folder)
    self.assertEqual(folder.parent_id, self.storage.object_id)
    self.assertEqual(folder.storage_id, self.storage.object_id)
    self.assertEqual(lower(name), lower(folder.name))
    name = u'sub-folder'
    subfolder = self.dev.create_folder(folder, name)
    self.assertTrue(subfolder.is_folder)
    self.assertEqual(subfolder.parent_id, folder.object_id)
    self.assertEqual(subfolder.storage_id, self.storage.object_id)
    self.assertEqual(lower(name), lower(subfolder.name))
    self.cleanup.append(subfolder)
    self.assertIs(subfolder, self.dev.create_folder(folder, u'SUB-FOLDER'), msg=u'Creating    an    existing    folder    did    not    return    the    existing    folder')
    root_file = [f for f in self.dev.filesystem_cache.entries[0].files if (not f.is_folder)]
    if root_file:
        with self.assertRaises(ValueError):
            self.dev.create_folder(root_file[0], u'sub-folder')
