File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,26 @@ def test_Files_Update_File(self):
264264
265265 self .DeleteUploadedFiles (drive , [file1 ["id" ]])
266266
267+ def test_Files_Update_File_Keeps_Filename (self ):
268+ # Tests https://github.com/iterative/PyDrive2/issues/272
269+ drive = GoogleDrive (self .ga )
270+ file1 = drive .CreateFile ()
271+ filename = self .getTempFile ("preupdatetestfile" )
272+ contentFile = self .getTempFile ("actual_content" , "some string" )
273+ contentFile2 = self .getTempFile ("actual_content_2" , "some string" )
274+
275+ file1 ["title" ] = filename
276+ file1 .SetContentFile (contentFile )
277+ pydrive_retry (file1 .Upload ) # Files.insert
278+ self .assertEqual (file1 .metadata ["title" ], filename )
279+
280+ same_file = drive .CreateFile ({"id" : file1 ["id" ]})
281+ same_file .SetContentFile (contentFile2 )
282+ pydrive_retry (same_file .Upload ) # Files.update
283+ self .assertEqual (same_file .metadata ["title" ], filename )
284+
285+ self .DeleteUploadedFiles (drive , [file1 ["id" ]])
286+
267287 def test_Files_Update_By_Id (self ):
268288 drive = GoogleDrive (self .ga )
269289 file1 = drive .CreateFile ()
You can’t perform that action at this time.
0 commit comments