def test_01_Files_List_GetList(self): drive = GoogleDrive(self.ga) query = "title = '{}' and trashed = false".format(self.title) for file1 in pydrive_list_item(drive, query): found = False for file2 in pydrive_list_item(drive, query): if file1['id'] == file2['id']: found = True self.assertEqual(found, True)
def test_02_Files_List_ForLoop(self): drive = GoogleDrive(self.ga) query = "title = '{}' and trashed = false".format(self.title) files = [] for x in pydrive_list_item( drive, query, 2): # Build iterator to access files simply with for loop files.append(x) for file1 in self.file_list: found = False for file2 in files: if file1['id'] == file2['id']: found = True self.assertEqual(found, True)
def test_File_List_Folders(self): drive = GoogleDrive(self.ga) folder1 = drive.CreateFile({ 'mimeType': 'application/vnd.google-apps.folder', 'title': self.title }) pydrive_retry(folder1.Upload) self.file_list.append(folder1) query = "title = '{}' and trashed = false".format(self.title) count = 0 for file1 in pydrive_list_item(drive, query): self.assertFileInFileList(file1) count += 1 self.assertTrue(count == 11)