mastodon-ios/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+OAuthTests....

30 lines
941 B
Swift
Raw Normal View History

2021-01-29 12:38:11 +01:00
//
// MastodonSDK+API+OAuthTests.swift
//
//
// Created by MainasuK Cirno on 2021/1/29.
//
import os.log
import XCTest
import Combine
@testable import MastodonSDK
extension MastodonSDKTests {
func testOAuthAuthorize() throws {
try _testOAuthAuthorize(domain: domain)
}
func _testOAuthAuthorize(domain: String) throws {
let query = Mastodon.API.OAuth.AuthorizeQuery(clientID: "StubClientID")
let authorizeURL = Mastodon.API.OAuth.authorizeURL(domain: domain, query: query)
os_log("%{public}s[%{public}ld], %{public}s: (%s) authorizeURL %s", ((#file as NSString).lastPathComponent), #line, #function, domain, authorizeURL.absoluteString)
XCTAssertEqual(
authorizeURL.absoluteString,
"https://\(domain)/oauth/authorize?response_type=code&clientID=StubClientID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=read%20write%20follow%20push"
)
}
}