Files
bundesmessenger-ios/RiotTests/Modules/Authentication/Mocks/MockSessionCreator.swift
T
Mauro Romito 12837d4b89 update license
2024-09-25 12:24:52 +02:00

21 lines
773 B
Swift

//
// Copyright 2022-2024 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only
// Please see LICENSE in the repository root for full details.
//
import Foundation
@testable import Element
struct MockSessionCreator: SessionCreatorProtocol {
/// Returns a basic session created from the supplied credentials. This prevents the app from setting up the account during tests.
@MainActor
func createSession(credentials: MXCredentials, client: AuthenticationRestClient, removeOtherAccounts: Bool) -> MXSession {
let client = MXRestClient(credentials: credentials,
unauthenticatedHandler: { _,_,_,_ in }) // The handler is expected if credentials are set.
return MXSession(matrixRestClient: client)
}
}