in OSSSwiftDemo/OSSSwiftDemoTests/OSSNormalObjectTests.swift [382:411]
func testAPI_deleteObject() {
let request = OSSPutObjectRequest()
let fileName = "swift"
let fileExtension = "pdf"
request.bucketName = OSS_BUCKET_PRIVATE
request.uploadingFileURL = Bundle.main.url(forResource: fileName, withExtension: fileExtension)!
request.objectKey = "putanddelete"
request.objectMeta = ["x-oss-meta-name1": "value1"];
request.contentType = "application/pdf"
request.uploadProgress = {(bytesSent, totalByteSent, totalBytesExpectedToSend) ->Void in
print("bytesSent: \(bytesSent),totalByteSent: \(totalByteSent),totalBytesExpectedToSend: \(totalBytesExpectedToSend)")
}
let task = client.putObject(request)
task.continue({ (t) -> Any? in
XCTAssertNil(t.error)
return nil
}).waitUntilFinished()
let otherRequest = OSSDeleteObjectRequest()
otherRequest.bucketName = OSS_BUCKET_PRIVATE
otherRequest.objectKey = "putanddelete"
let otherTask = client.deleteObject(otherRequest)
otherTask.continue({ (t) -> Any? in
XCTAssertNil(t.error)
return nil
}).waitUntilFinished()
}