mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-28 03:48:37 +03:00
Fix unit tests
This commit is contained in:
parent
f6016d7b55
commit
f18cc5e53b
2 changed files with 6 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue