func testAPI_abortResumableUpload()

in OSSSwiftDemo/OSSSwiftDemoTests/OSSResumableUploadTests.swift [44:65]


    func testAPI_abortResumableUpload() {
        let fileURL = Bundle.main.url(forResource: "wangwang", withExtension: "zip")
        let request = OSSResumableUploadRequest()
        request.uploadingFileURL = fileURL!
        request.partSize = 307200
        request.bucketName = OSS_BUCKET_PUBLIC
        request.objectKey = OSS_RESUMABLE_UPLOADKEY
        request.deleteUploadIdOnCancelling = true
        request.uploadProgress = {[weak request](bytesSent, totalByteSent, totalBytesExpectedToSend) ->Void in
            print("bytesSent: \(bytesSent),totalByteSent: \(totalByteSent),totalBytesExpectedToSend: \(totalBytesExpectedToSend)")
            if totalByteSent > totalBytesExpectedToSend / 2 {
                request?.cancel()
            }
        }
        
        let task = client.resumableUpload(request)
        task.continue({ (t) -> Any? in
            XCTAssertNotNil(t.error)
            
            return nil
        }).waitUntilFinished()
    }