def setup_class(cls): setup_credentials() create_file(cls.first_file, cls.first_file) create_file(cls.second_file, cls.second_file) cls.ga = GoogleAuth('pydrive2/test/settings/default.yaml') cls.ga.ServiceAuth()
def setup_class(cls): setup_credentials() create_file(cls.first_file, cls.first_file) create_file(cls.second_file, cls.second_file) cls.ga = GoogleAuth(settings_file_path("default.yaml")) cls.ga.ServiceAuth()
def test_12_Upload_Download_Empty_File(self): filename = os.path.join(self.tmpdir, str(time())) create_file(filename, "") drive = GoogleDrive(self.ga) file1 = drive.CreateFile() file1.SetContentFile(filename) pydrive_retry(file1.Upload) fileOut1 = self.getTempFile() pydrive_retry(file1.GetContentFile, fileOut1) self.assertEqual(os.path.getsize(fileOut1), 0) self.DeleteUploadedFiles(drive, [file1["id"]])
def getTempFile(cls, prefix="", content=""): filename = os.path.join(cls.tmpdir, prefix + str(time())) if content: create_file(filename, content) return filename