From f18cc5e53b38ae5f94895ecb7a141f442d3fa04e Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Sun, 14 Aug 2022 21:57:35 +0100 Subject: [PATCH] Fix unit tests --- .../app/features/onboarding/OnboardingViewModelTest.kt | 5 +++-- .../im/vector/app/test/fakes/FakeAuthenticationService.kt | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt b/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt index b8a0be9529..6107af1551 100644 --- a/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt @@ -54,6 +54,7 @@ import org.amshove.kluent.shouldBeEqualTo import org.junit.Before import org.junit.Rule import org.junit.Test +import org.matrix.android.sdk.api.auth.SSOAction import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig import org.matrix.android.sdk.api.auth.data.SsoIdentityProvider import org.matrix.android.sdk.api.auth.registration.Stage @@ -896,9 +897,9 @@ class OnboardingViewModelTest { fun `given returns Sso url, when fetching Sso url, then updates authentication state and returns supplied Sso url`() = runTest { val test = viewModel.test() val provider = SsoIdentityProvider(id = "provider_id", null, null, null) - fakeAuthenticationService.givenSsoUrl(A_REDIRECT_URI, A_DEVICE_ID, provider.id, result = A_SSO_URL) + fakeAuthenticationService.givenSsoUrl(A_REDIRECT_URI, A_DEVICE_ID, provider.id, SSOAction.LOGIN, result = A_SSO_URL) - val result = viewModel.fetchSsoUrl(A_REDIRECT_URI, A_DEVICE_ID, provider) + val result = viewModel.fetchSsoUrl(A_REDIRECT_URI, A_DEVICE_ID, provider, SSOAction.LOGIN) result shouldBeEqualTo A_SSO_URL test diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeAuthenticationService.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeAuthenticationService.kt index af53913169..fa446537c8 100644 --- a/vector/src/test/java/im/vector/app/test/fakes/FakeAuthenticationService.kt +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeAuthenticationService.kt @@ -22,6 +22,7 @@ import io.mockk.coVerify import io.mockk.every import io.mockk.mockk import org.matrix.android.sdk.api.auth.AuthenticationService +import org.matrix.android.sdk.api.auth.SSOAction import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig import org.matrix.android.sdk.api.auth.data.LoginFlowResult import org.matrix.android.sdk.api.auth.login.LoginWizard @@ -78,7 +79,7 @@ class FakeAuthenticationService : AuthenticationService by mockk() { coVerify { cancelPendingLoginOrRegistration() } } - fun givenSsoUrl(redirectUri: String, deviceId: String, providerId: String, result: String) { - coEvery { getSsoUrl(redirectUri, deviceId, providerId) } returns result + fun givenSsoUrl(redirectUri: String, deviceId: String, providerId: String, action: SSOAction, result: String) { + coEvery { getSsoUrl(redirectUri, deviceId, providerId, action) } returns result } }