def test_upload_download_update_and_delete_new_file(self): # Given file_path = create_random_file() add_random_content_to_file(file_path) previous_size = get_size(file_path) file_name = "newdatalordstest" out_file = generate_random_file_path() # When file_id = self.google_drive.upload_new_file(file_path) add_random_content_to_file(file_path) self.google_drive.update_file(file_path, file_id) self.google_drive.download_file(file_id, out_file) # Then self.assertTrue(os.path.exists(out_file)) self.assertTrue(get_size(out_file) > previous_size) # When self.google_drive.delete_file(file_id) # Then # with self.assertRaises(): self.google_drive.drive.CreateFile({'id' : file_id}) # Clean delete_file(file_path)
def test_upload_download_and_delete_new_file(self): # Given file_path = create_random_file() add_random_content_to_file(file_path) file_name = "newdatalordstest.dlords" out_file = generate_random_file_path() # When file_id = self.box.upload_new_file(file_path) self.box.download_file(file_id, out_file) # Then self.assertTrue(os.path.exists(out_file)) self.assertTrue(get_size(out_file) > 0) # When self.box.delete_file(file_id) # Then with self.assertRaises(BoxAPIException): self.box.client.file(file_id=file_id).get() # Clean delete_file(file_path) delete_file(out_file)
def test_upload_new_file(self): # Given tempfile = create_random_file() # When self.disk.upload_new_file(tempfile) # Then self.assertEqual(get_number_of_files_in_dir(self.tempdir), 1) # Clean delete_file(tempfile)
def test_upload_and_delete_new_file(self): # Given file_path = create_random_file() add_random_content_to_file(file_path) file_name = "newdatalordstest" # When file_name = self.dropbox.upload_new_file(file_path) # Then metadata = self.dropbox.get_metadata(file_name) self.assertEqual(metadata['path'], '/' + file_name) # When self.dropbox.delete_file(file_name) # Then self.assertFalse(self.dropbox.exists(file_name)) # Clean delete_file(file_path)