def test_transfer_ownership(request_mock) -> None: request_mock._iterable.append( ({"status": "200"}, read_datafile("transferownership.json", "rb")), ) f = File("myfile", "0123456") assert f.transfer_ownership("*****@*****.**") == f
def test_copyTo(request_mock) -> None: request_mock._iterable.append( ({"status": "200"}, read_datafile("copyfile.json", "rb")), ) f = File("myfile", "0123456") folder = Folder("myfolder", "abcdef") new_file = f.copyTo(folder, "New name") assert new_file.file_id == "MyNewId__" assert new_file.file_name == "Copy"
def do(self) -> None: DriveService.configure(self.options.get("credentials")) user = self.options.get("user") role = self.options.get("role") fileId = self.options.get("fileid") file = File(fileId, fileId) if role == "owner": file.transfer_ownership(user) else: file.share(user, role, False)
def do(self) -> None: DriveService.configure(self.options.get("credentials")) fileId = self.options.get("fileid") file = File(fileId, fileId) file.delete()
def test_init(request_mock) -> None: f = File("myfile", "0123456") assert f.client is not None
def test_delete(request_mock) -> None: request_mock._iterable.append( ({"status": "204"}, "{}"), ) File("myfile", "0123456").delete()
def test_share(request_mock) -> None: request_mock._iterable.append( ({"status": "200"}, read_datafile("sharefile.json", "rb")), ) f = File("myfile", "0123456") assert f.share("*****@*****.**", "writer", False) == f