func testParseTokenFromURL_withSuccess()

in source/UberCoreTests/AccessTokenFactoryTests.swift [47:69]


    func testParseTokenFromURL_withSuccess() {
        var components = URLComponents()
        components.fragment = "access_token=\(tokenString)&refresh_token=\(refreshTokenString)&token_type=\(tokenTypeString)&expires_in=\(expirationTime)&scope=\(allowedScopesString)"
        components.host = redirectURI
        guard let url = components.url else {
            XCTAssert(false)
            return
        }
        do {
            let token : AccessToken = try AccessTokenFactory.createAccessToken(fromRedirectURL: url)
            XCTAssertNotNil(token)
            XCTAssertEqual(token.tokenString, tokenString)
            XCTAssertEqual(token.refreshToken, refreshTokenString)
            XCTAssertEqual(token.tokenType, tokenTypeString)
            XCTAssertEqual(token.grantedScopes.toUberScopeString(), allowedScopesString)
            UBSDKAssert(date: token.expirationDate!, approximatelyIn: expirationTime)
            
        } catch _ as NSError {
            XCTAssert(false)
        } catch {
            XCTAssert(false)
        }
    }