2020-08-09 10:04:43 +02:00
|
|
|
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
|
|
|
|
import Combine
|
|
|
|
import CombineExpectations
|
2020-08-31 20:57:02 +02:00
|
|
|
@testable import ServiceLayer
|
|
|
|
@testable import ServiceLayerMocks
|
2020-09-05 04:31:43 +02:00
|
|
|
import XCTest
|
2020-08-09 10:04:43 +02:00
|
|
|
|
2020-11-09 07:22:20 +01:00
|
|
|
final class AuthenticationServiceTests: XCTestCase {
|
2020-08-09 13:27:38 +02:00
|
|
|
func testAuthentication() throws {
|
2020-09-09 03:02:55 +02:00
|
|
|
let sut = AuthenticationService(url: URL(string: "https://mastodon.social")!, environment: .mock())
|
|
|
|
let authenticationRecorder = sut.authenticate().record()
|
|
|
|
let (appAuthorization, accessToken) = try wait(for: authenticationRecorder.next(), timeout: 1)
|
2020-08-09 10:04:43 +02:00
|
|
|
|
2020-08-09 13:27:38 +02:00
|
|
|
XCTAssertEqual(appAuthorization.clientId, "AUTHORIZATION_CLIENT_ID_STUB_VALUE")
|
|
|
|
XCTAssertEqual(appAuthorization.clientSecret, "AUTHORIZATION_CLIENT_SECRET_STUB_VALUE")
|
|
|
|
XCTAssertEqual(accessToken.accessToken, "ACCESS_TOKEN_STUB_VALUE")
|
2020-08-09 10:04:43 +02:00
|
|
|
}
|
|
|
|
}
|