func testAPI_presignConstrainURLWithCustomPath()

in OSSSwiftDemo/OSSSwiftDemoTests/OSSNormalObjectTests.swift [616:631]


    func testAPI_presignConstrainURLWithCustomPath() {
        let customEndpoint = "\(ENDPOINT)/path"
        let config = OSSClientConfiguration()
        config.isCustomPathPrefixEnable = true
        let authProv = OSSAuthCredentialProvider(authServerUrl: OSS_STSTOKEN_URL)
        let client = OSSClient(endpoint: customEndpoint, credentialProvider: authProv, clientConfiguration: config)
        let tk = client.presignConstrainURL(withBucketName: BUCKET_NAME,
                                            withObjectKey: OBJECT_KEY,
                                            withExpirationInterval: 30 * 60)
        let urlString = "\(SCHEME)\(BUCKET_NAME).\(customEndpoint)/\(OBJECT_KEY)"
        if let result = tk.result as? String {
            XCTAssertTrue(result.hasPrefix(urlString))
        } else {
            XCTAssertTrue(false)
        }
    }