mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 09:55:40 +03:00
Test case for OIDC compatibility
This commit is contained in:
parent
624e2ffb19
commit
51f227a13b
1 changed files with 18 additions and 2 deletions
|
@ -131,6 +131,21 @@ class StartAuthenticationFlowUseCaseTest {
|
|||
verifyClearsAndThenStartsLogin(A_HOMESERVER_CONFIG)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `given identity providers and login supports SSO with OIDC compatibility then prefers Sso for compatibility`() = runTest {
|
||||
val loginResult = aLoginResult(supportedLoginTypes = SSO_LOGIN_TYPE, ssoProviders = SSO_IDENTITY_PROVIDERS, hasOidcCompatibilityFlow = true)
|
||||
fakeAuthenticationService.givenLoginFlow(A_HOMESERVER_CONFIG, loginResult)
|
||||
|
||||
val result = useCase.execute(A_HOMESERVER_CONFIG)
|
||||
|
||||
result shouldBeEqualTo expectedResult(
|
||||
supportedLoginTypes = SSO_LOGIN_TYPE,
|
||||
preferredLoginMode = LoginMode.Sso(SsoState.IdentityProviders(SSO_IDENTITY_PROVIDERS), hasOidcCompatibilityFlow = true),
|
||||
hasOidcCompatibilityFlow = true
|
||||
)
|
||||
verifyClearsAndThenStartsLogin(A_HOMESERVER_CONFIG)
|
||||
}
|
||||
|
||||
private fun aLoginResult(
|
||||
supportedLoginTypes: List<String>,
|
||||
ssoProviders: List<SsoIdentityProvider> = FALLBACK_SSO_IDENTITY_PROVIDERS,
|
||||
|
@ -150,7 +165,8 @@ class StartAuthenticationFlowUseCaseTest {
|
|||
isHomeserverOutdated: Boolean = false,
|
||||
preferredLoginMode: LoginMode = LoginMode.Unsupported,
|
||||
supportedLoginTypes: List<String> = emptyList(),
|
||||
homeserverSourceUrl: String = A_HOMESERVER_CONFIG.homeServerUri.toString()
|
||||
homeserverSourceUrl: String = A_HOMESERVER_CONFIG.homeServerUri.toString(),
|
||||
hasOidcCompatibilityFlow: Boolean = false
|
||||
) = StartAuthenticationResult(
|
||||
isHomeserverOutdated,
|
||||
SelectedHomeserverState(
|
||||
|
@ -158,7 +174,7 @@ class StartAuthenticationFlowUseCaseTest {
|
|||
upstreamUrl = A_DECLARED_HOMESERVER_URL,
|
||||
preferredLoginMode = preferredLoginMode,
|
||||
supportedLoginTypes = supportedLoginTypes,
|
||||
hasOidcCompatibilityFlow = false
|
||||
hasOidcCompatibilityFlow = hasOidcCompatibilityFlow
|
||||
)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue