From 7896bf9023047231579ffcc5b8c88c47f8db00df Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Fri, 4 Mar 2022 21:36:10 +0100 Subject: [PATCH] Removes HomeServerConnectionConfigFixture --- .../auth/DefaultSessionCreatorTest.kt | 4 +- .../DefaultSessionParamsCreatorTestBase.kt | 4 +- .../HomeServerConnectionConfigFixture.kt | 51 ------------------- .../sdk/test/fixtures/SessionParamsFixture.kt | 3 +- 4 files changed, 5 insertions(+), 57 deletions(-) delete mode 100644 matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fixtures/HomeServerConnectionConfigFixture.kt diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/auth/DefaultSessionCreatorTest.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/auth/DefaultSessionCreatorTest.kt index 35558fda2f..b389dc5feb 100644 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/auth/DefaultSessionCreatorTest.kt +++ b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/auth/DefaultSessionCreatorTest.kt @@ -19,13 +19,13 @@ package org.matrix.android.sdk.internal.auth import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runBlockingTest 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.test.fakes.internal.FakeSessionManager 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.FakeSessionParamsStore 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 @ExperimentalCoroutinesApi @@ -56,6 +56,6 @@ class DefaultSessionCreatorTest { companion object { private val sessionParams = aSessionParams() private val credentials = aCredentials() - private val homeServerConnectionConfig = aHomeServerConnectionConfig() + private val homeServerConnectionConfig = HomeServerConnectionConfig.Builder().withHomeServerUri("homeserver").build() } } diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/auth/DefaultSessionParamsCreatorTestBase.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/auth/DefaultSessionParamsCreatorTestBase.kt index 61b808dd1a..9c810ff0dc 100644 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/auth/DefaultSessionParamsCreatorTestBase.kt +++ b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/auth/DefaultSessionParamsCreatorTestBase.kt @@ -19,11 +19,11 @@ package org.matrix.android.sdk.internal.auth import android.net.Uri import org.amshove.kluent.shouldBeEqualTo 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.internal.auth.login.LoginType 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.HomeServerConnectionConfigFixture.aHomeServerConnectionConfig import org.matrix.android.sdk.test.fixtures.WellKnownBaseConfigFixture.aWellKnownBaseConfig abstract class DefaultSessionParamsCreatorTestBase { @@ -33,7 +33,7 @@ abstract class DefaultSessionParamsCreatorTestBase { protected val credentials = aCredentials() protected val credentialsWithHomeServer = aCredentials(discoveryInformation = discoveryWithHomeServer) protected val credentialsWithIdentityServer = aCredentials(discoveryInformation = discoveryWithIdentityServer) - protected val homeServerConnectionConfig = aHomeServerConnectionConfig() + protected val homeServerConnectionConfig = HomeServerConnectionConfig.Builder().withHomeServerUri("homeserver").build() protected fun assertExpectedSessionParams(sessionParams: SessionParams) { sessionParams shouldBeEqualTo SessionParams( diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fixtures/HomeServerConnectionConfigFixture.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fixtures/HomeServerConnectionConfigFixture.kt deleted file mode 100644 index 2b3d8cc4fa..0000000000 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fixtures/HomeServerConnectionConfigFixture.kt +++ /dev/null @@ -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 = emptyList(), - shouldPin: Boolean = false, - tlsVersions: List? = null, - tlsCipherSuites: List? = null, - shouldAcceptTlsExtensions: Boolean = true, - allowHttpExtension: Boolean = false, - forceUsageTlsVersions: Boolean = false - ) = HomeServerConnectionConfig( - homeServerUri, - homeServerUriBase, - identityServerUri, - antiVirusServerUri, - allowedFingerprints, - shouldPin, - tlsVersions, - tlsCipherSuites, - shouldAcceptTlsExtensions, - allowHttpExtension, - forceUsageTlsVersions, - ) -} diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fixtures/SessionParamsFixture.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fixtures/SessionParamsFixture.kt index 37f18d1221..079b42b9e7 100644 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fixtures/SessionParamsFixture.kt +++ b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fixtures/SessionParamsFixture.kt @@ -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.internal.auth.login.LoginType import org.matrix.android.sdk.test.fixtures.CredentialsFixture.aCredentials -import org.matrix.android.sdk.test.fixtures.HomeServerConnectionConfigFixture.aHomeServerConnectionConfig object SessionParamsFixture { fun aSessionParams( credentials: Credentials = aCredentials(), - homeServerConnectionConfig: HomeServerConnectionConfig = aHomeServerConnectionConfig(), + homeServerConnectionConfig: HomeServerConnectionConfig = HomeServerConnectionConfig.Builder().withHomeServerUri("homeserver").build(), isTokenValid: Boolean = false, loginType: LoginType = LoginType.UNKNOWN, ) = SessionParams(