Removes HomeServerConnectionConfigFixture

This commit is contained in:
ericdecanini 2022-03-04 21:36:10 +01:00
parent 2d07b80ace
commit 7896bf9023
4 changed files with 5 additions and 57 deletions

View file

@ -19,13 +19,13 @@ package org.matrix.android.sdk.internal.auth
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runBlockingTest import kotlinx.coroutines.test.runBlockingTest
import org.junit.Test import org.junit.Test
import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig
import org.matrix.android.sdk.internal.auth.login.LoginType import org.matrix.android.sdk.internal.auth.login.LoginType
import org.matrix.android.sdk.test.fakes.internal.FakeSessionManager import org.matrix.android.sdk.test.fakes.internal.FakeSessionManager
import org.matrix.android.sdk.test.fakes.internal.auth.FakePendingSessionStore import org.matrix.android.sdk.test.fakes.internal.auth.FakePendingSessionStore
import org.matrix.android.sdk.test.fakes.internal.auth.FakeSessionParamsCreator import org.matrix.android.sdk.test.fakes.internal.auth.FakeSessionParamsCreator
import org.matrix.android.sdk.test.fakes.internal.auth.FakeSessionParamsStore import org.matrix.android.sdk.test.fakes.internal.auth.FakeSessionParamsStore
import org.matrix.android.sdk.test.fixtures.CredentialsFixture.aCredentials import org.matrix.android.sdk.test.fixtures.CredentialsFixture.aCredentials
import org.matrix.android.sdk.test.fixtures.HomeServerConnectionConfigFixture.aHomeServerConnectionConfig
import org.matrix.android.sdk.test.fixtures.SessionParamsFixture.aSessionParams import org.matrix.android.sdk.test.fixtures.SessionParamsFixture.aSessionParams
@ExperimentalCoroutinesApi @ExperimentalCoroutinesApi
@ -56,6 +56,6 @@ class DefaultSessionCreatorTest {
companion object { companion object {
private val sessionParams = aSessionParams() private val sessionParams = aSessionParams()
private val credentials = aCredentials() private val credentials = aCredentials()
private val homeServerConnectionConfig = aHomeServerConnectionConfig() private val homeServerConnectionConfig = HomeServerConnectionConfig.Builder().withHomeServerUri("homeserver").build()
} }
} }

View file

@ -19,11 +19,11 @@ package org.matrix.android.sdk.internal.auth
import android.net.Uri import android.net.Uri
import org.amshove.kluent.shouldBeEqualTo import org.amshove.kluent.shouldBeEqualTo
import org.matrix.android.sdk.api.auth.data.DiscoveryInformation import org.matrix.android.sdk.api.auth.data.DiscoveryInformation
import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig
import org.matrix.android.sdk.api.auth.data.SessionParams import org.matrix.android.sdk.api.auth.data.SessionParams
import org.matrix.android.sdk.internal.auth.login.LoginType import org.matrix.android.sdk.internal.auth.login.LoginType
import org.matrix.android.sdk.test.fixtures.CredentialsFixture.aCredentials import org.matrix.android.sdk.test.fixtures.CredentialsFixture.aCredentials
import org.matrix.android.sdk.test.fixtures.DiscoveryInformationFixture.aDiscoveryInformation import org.matrix.android.sdk.test.fixtures.DiscoveryInformationFixture.aDiscoveryInformation
import org.matrix.android.sdk.test.fixtures.HomeServerConnectionConfigFixture.aHomeServerConnectionConfig
import org.matrix.android.sdk.test.fixtures.WellKnownBaseConfigFixture.aWellKnownBaseConfig import org.matrix.android.sdk.test.fixtures.WellKnownBaseConfigFixture.aWellKnownBaseConfig
abstract class DefaultSessionParamsCreatorTestBase { abstract class DefaultSessionParamsCreatorTestBase {
@ -33,7 +33,7 @@ abstract class DefaultSessionParamsCreatorTestBase {
protected val credentials = aCredentials() protected val credentials = aCredentials()
protected val credentialsWithHomeServer = aCredentials(discoveryInformation = discoveryWithHomeServer) protected val credentialsWithHomeServer = aCredentials(discoveryInformation = discoveryWithHomeServer)
protected val credentialsWithIdentityServer = aCredentials(discoveryInformation = discoveryWithIdentityServer) protected val credentialsWithIdentityServer = aCredentials(discoveryInformation = discoveryWithIdentityServer)
protected val homeServerConnectionConfig = aHomeServerConnectionConfig() protected val homeServerConnectionConfig = HomeServerConnectionConfig.Builder().withHomeServerUri("homeserver").build()
protected fun assertExpectedSessionParams(sessionParams: SessionParams) { protected fun assertExpectedSessionParams(sessionParams: SessionParams) {
sessionParams shouldBeEqualTo SessionParams( sessionParams shouldBeEqualTo SessionParams(

View file

@ -1,51 +0,0 @@
/*
* Copyright (c) 2022 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.matrix.android.sdk.test.fixtures
import android.net.Uri
import okhttp3.CipherSuite
import okhttp3.TlsVersion
import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig
import org.matrix.android.sdk.internal.network.ssl.Fingerprint
object HomeServerConnectionConfigFixture {
fun aHomeServerConnectionConfig(
homeServerUri: Uri = Uri.parse("aUri"),
homeServerUriBase: Uri = homeServerUri,
identityServerUri: Uri? = null,
antiVirusServerUri: Uri? = null,
allowedFingerprints: List<Fingerprint> = emptyList(),
shouldPin: Boolean = false,
tlsVersions: List<TlsVersion>? = null,
tlsCipherSuites: List<CipherSuite>? = null,
shouldAcceptTlsExtensions: Boolean = true,
allowHttpExtension: Boolean = false,
forceUsageTlsVersions: Boolean = false
) = HomeServerConnectionConfig(
homeServerUri,
homeServerUriBase,
identityServerUri,
antiVirusServerUri,
allowedFingerprints,
shouldPin,
tlsVersions,
tlsCipherSuites,
shouldAcceptTlsExtensions,
allowHttpExtension,
forceUsageTlsVersions,
)
}

View file

@ -21,12 +21,11 @@ import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig
import org.matrix.android.sdk.api.auth.data.SessionParams import org.matrix.android.sdk.api.auth.data.SessionParams
import org.matrix.android.sdk.internal.auth.login.LoginType import org.matrix.android.sdk.internal.auth.login.LoginType
import org.matrix.android.sdk.test.fixtures.CredentialsFixture.aCredentials import org.matrix.android.sdk.test.fixtures.CredentialsFixture.aCredentials
import org.matrix.android.sdk.test.fixtures.HomeServerConnectionConfigFixture.aHomeServerConnectionConfig
object SessionParamsFixture { object SessionParamsFixture {
fun aSessionParams( fun aSessionParams(
credentials: Credentials = aCredentials(), credentials: Credentials = aCredentials(),
homeServerConnectionConfig: HomeServerConnectionConfig = aHomeServerConnectionConfig(), homeServerConnectionConfig: HomeServerConnectionConfig = HomeServerConnectionConfig.Builder().withHomeServerUri("homeserver").build(),
isTokenValid: Boolean = false, isTokenValid: Boolean = false,
loginType: LoginType = LoginType.UNKNOWN, loginType: LoginType = LoginType.UNKNOWN,
) = SessionParams( ) = SessionParams(