Rename class (code quality)
This commit is contained in:
@@ -20,21 +20,21 @@ import com.bumble.appyx.core.state.MutableSavedStateMapImpl
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import io.element.android.libraries.matrix.test.A_SESSION_ID
|
||||
import io.element.android.libraries.matrix.test.FakeMatrixClient
|
||||
import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Test
|
||||
|
||||
class MatrixClientsHolderTest {
|
||||
@Test
|
||||
fun `test getOrNull`() {
|
||||
val fakeAuthenticationService = FakeAuthenticationService()
|
||||
val fakeAuthenticationService = FakeMatrixAuthenticationService()
|
||||
val matrixClientsHolder = MatrixClientsHolder(fakeAuthenticationService)
|
||||
assertThat(matrixClientsHolder.getOrNull(A_SESSION_ID)).isNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test getOrRestore`() = runTest {
|
||||
val fakeAuthenticationService = FakeAuthenticationService()
|
||||
val fakeAuthenticationService = FakeMatrixAuthenticationService()
|
||||
val matrixClientsHolder = MatrixClientsHolder(fakeAuthenticationService)
|
||||
val fakeMatrixClient = FakeMatrixClient()
|
||||
fakeAuthenticationService.givenMatrixClient(fakeMatrixClient)
|
||||
@@ -47,7 +47,7 @@ class MatrixClientsHolderTest {
|
||||
|
||||
@Test
|
||||
fun `test remove`() = runTest {
|
||||
val fakeAuthenticationService = FakeAuthenticationService()
|
||||
val fakeAuthenticationService = FakeMatrixAuthenticationService()
|
||||
val matrixClientsHolder = MatrixClientsHolder(fakeAuthenticationService)
|
||||
val fakeMatrixClient = FakeMatrixClient()
|
||||
fakeAuthenticationService.givenMatrixClient(fakeMatrixClient)
|
||||
@@ -60,7 +60,7 @@ class MatrixClientsHolderTest {
|
||||
|
||||
@Test
|
||||
fun `test remove all`() = runTest {
|
||||
val fakeAuthenticationService = FakeAuthenticationService()
|
||||
val fakeAuthenticationService = FakeMatrixAuthenticationService()
|
||||
val matrixClientsHolder = MatrixClientsHolder(fakeAuthenticationService)
|
||||
val fakeMatrixClient = FakeMatrixClient()
|
||||
fakeAuthenticationService.givenMatrixClient(fakeMatrixClient)
|
||||
@@ -73,7 +73,7 @@ class MatrixClientsHolderTest {
|
||||
|
||||
@Test
|
||||
fun `test save and restore`() = runTest {
|
||||
val fakeAuthenticationService = FakeAuthenticationService()
|
||||
val fakeAuthenticationService = FakeMatrixAuthenticationService()
|
||||
val matrixClientsHolder = MatrixClientsHolder(fakeAuthenticationService)
|
||||
val fakeMatrixClient = FakeMatrixClient()
|
||||
fakeAuthenticationService.givenMatrixClient(fakeMatrixClient)
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.google.common.truth.Truth.assertThat
|
||||
import io.element.android.features.lockscreen.impl.unlock.signout.DefaultSignOut
|
||||
import io.element.android.libraries.matrix.test.FakeMatrixClient
|
||||
import io.element.android.libraries.matrix.test.FakeMatrixClientProvider
|
||||
import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService
|
||||
import io.element.android.tests.testutils.lambda.assert
|
||||
import io.element.android.tests.testutils.lambda.lambdaRecorder
|
||||
import kotlinx.coroutines.test.runTest
|
||||
@@ -28,7 +28,7 @@ import org.junit.Test
|
||||
|
||||
class DefaultSignOutTest {
|
||||
private val matrixClient = FakeMatrixClient()
|
||||
private val authenticationService = FakeAuthenticationService()
|
||||
private val authenticationService = FakeMatrixAuthenticationService()
|
||||
private val matrixClientProvider = FakeMatrixClientProvider(getClient = { Result.success(matrixClient) })
|
||||
private val sut = DefaultSignOut(authenticationService, matrixClientProvider)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import io.element.android.features.login.impl.accountprovider.AccountProviderDat
|
||||
import io.element.android.libraries.architecture.AsyncData
|
||||
import io.element.android.libraries.matrix.test.A_HOMESERVER
|
||||
import io.element.android.libraries.matrix.test.A_HOMESERVER_URL
|
||||
import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService
|
||||
import io.element.android.tests.testutils.WarmUpRule
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Rule
|
||||
@@ -38,7 +38,7 @@ class ChangeServerPresenterTest {
|
||||
@Test
|
||||
fun `present - initial state`() = runTest {
|
||||
val presenter = ChangeServerPresenter(
|
||||
FakeAuthenticationService(),
|
||||
FakeMatrixAuthenticationService(),
|
||||
AccountProviderDataSource()
|
||||
)
|
||||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
@@ -51,7 +51,7 @@ class ChangeServerPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - change server ok`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val presenter = ChangeServerPresenter(
|
||||
authenticationService,
|
||||
AccountProviderDataSource()
|
||||
@@ -72,7 +72,7 @@ class ChangeServerPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - change server error`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val presenter = ChangeServerPresenter(
|
||||
authenticationService,
|
||||
AccountProviderDataSource()
|
||||
|
||||
@@ -26,7 +26,7 @@ import io.element.android.features.login.api.oidc.OidcAction
|
||||
import io.element.android.libraries.architecture.AsyncAction
|
||||
import io.element.android.libraries.matrix.test.A_THROWABLE
|
||||
import io.element.android.libraries.matrix.test.auth.A_OIDC_DATA
|
||||
import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService
|
||||
import io.element.android.tests.testutils.WarmUpRule
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.test.runTest
|
||||
@@ -41,7 +41,7 @@ class OidcPresenterTest {
|
||||
fun `present - initial state`() = runTest {
|
||||
val presenter = OidcPresenter(
|
||||
A_OIDC_DATA,
|
||||
FakeAuthenticationService(),
|
||||
FakeMatrixAuthenticationService(),
|
||||
)
|
||||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
presenter.present()
|
||||
@@ -56,7 +56,7 @@ class OidcPresenterTest {
|
||||
fun `present - go back`() = runTest {
|
||||
val presenter = OidcPresenter(
|
||||
A_OIDC_DATA,
|
||||
FakeAuthenticationService(),
|
||||
FakeMatrixAuthenticationService(),
|
||||
)
|
||||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
presenter.present()
|
||||
@@ -72,7 +72,7 @@ class OidcPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - go back with failure`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val presenter = OidcPresenter(
|
||||
A_OIDC_DATA,
|
||||
authenticationService,
|
||||
@@ -95,7 +95,7 @@ class OidcPresenterTest {
|
||||
fun `present - user cancels from webview`() = runTest {
|
||||
val presenter = OidcPresenter(
|
||||
A_OIDC_DATA,
|
||||
FakeAuthenticationService(),
|
||||
FakeMatrixAuthenticationService(),
|
||||
)
|
||||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
presenter.present()
|
||||
@@ -113,7 +113,7 @@ class OidcPresenterTest {
|
||||
fun `present - login success`() = runTest {
|
||||
val presenter = OidcPresenter(
|
||||
A_OIDC_DATA,
|
||||
FakeAuthenticationService(),
|
||||
FakeMatrixAuthenticationService(),
|
||||
)
|
||||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
presenter.present()
|
||||
@@ -128,7 +128,7 @@ class OidcPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - login error`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val presenter = OidcPresenter(
|
||||
A_OIDC_DATA,
|
||||
authenticationService,
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.google.common.truth.Truth.assertThat
|
||||
import io.element.android.features.login.impl.accountprovider.AccountProvider
|
||||
import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource
|
||||
import io.element.android.features.login.impl.changeserver.ChangeServerPresenter
|
||||
import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService
|
||||
import io.element.android.tests.testutils.WarmUpRule
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Rule
|
||||
@@ -36,7 +36,7 @@ class ChangeAccountProviderPresenterTest {
|
||||
@Test
|
||||
fun `present - initial state`() = runTest {
|
||||
val changeServerPresenter = ChangeServerPresenter(
|
||||
FakeAuthenticationService(),
|
||||
FakeMatrixAuthenticationService(),
|
||||
AccountProviderDataSource()
|
||||
)
|
||||
val presenter = ChangeAccountProviderPresenter(
|
||||
|
||||
@@ -30,7 +30,7 @@ import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.A_HOMESERVER
|
||||
import io.element.android.libraries.matrix.test.A_HOMESERVER_OIDC
|
||||
import io.element.android.libraries.matrix.test.A_THROWABLE
|
||||
import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService
|
||||
import io.element.android.tests.testutils.WarmUpRule
|
||||
import io.element.android.tests.testutils.waitForPredicate
|
||||
import kotlinx.coroutines.test.runTest
|
||||
@@ -57,7 +57,7 @@ class ConfirmAccountProviderPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - continue password login`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val presenter = createConfirmAccountProviderPresenter(
|
||||
matrixAuthenticationService = authenticationService,
|
||||
)
|
||||
@@ -79,7 +79,7 @@ class ConfirmAccountProviderPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - continue oidc`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val presenter = createConfirmAccountProviderPresenter(
|
||||
matrixAuthenticationService = authenticationService,
|
||||
)
|
||||
@@ -101,7 +101,7 @@ class ConfirmAccountProviderPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - oidc - cancel with failure`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val defaultOidcActionFlow = DefaultOidcActionFlow()
|
||||
val presenter = createConfirmAccountProviderPresenter(
|
||||
matrixAuthenticationService = authenticationService,
|
||||
@@ -129,7 +129,7 @@ class ConfirmAccountProviderPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - oidc - cancel with success`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val defaultOidcActionFlow = DefaultOidcActionFlow()
|
||||
val presenter = createConfirmAccountProviderPresenter(
|
||||
matrixAuthenticationService = authenticationService,
|
||||
@@ -156,7 +156,7 @@ class ConfirmAccountProviderPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - oidc - success with failure`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val defaultOidcActionFlow = DefaultOidcActionFlow()
|
||||
val presenter = createConfirmAccountProviderPresenter(
|
||||
matrixAuthenticationService = authenticationService,
|
||||
@@ -186,7 +186,7 @@ class ConfirmAccountProviderPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - oidc - success with success`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val defaultOidcActionFlow = DefaultOidcActionFlow()
|
||||
val defaultLoginUserStory = DefaultLoginUserStory().apply {
|
||||
setLoginFlowIsDone(false)
|
||||
@@ -219,7 +219,7 @@ class ConfirmAccountProviderPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - submit fails`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val presenter = createConfirmAccountProviderPresenter(
|
||||
matrixAuthenticationService = authenticationService,
|
||||
)
|
||||
@@ -238,7 +238,7 @@ class ConfirmAccountProviderPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - clear error`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val presenter = createConfirmAccountProviderPresenter(
|
||||
matrixAuthenticationService = authenticationService,
|
||||
)
|
||||
@@ -267,7 +267,7 @@ class ConfirmAccountProviderPresenterTest {
|
||||
private fun createConfirmAccountProviderPresenter(
|
||||
params: ConfirmAccountProviderPresenter.Params = ConfirmAccountProviderPresenter.Params(isAccountCreation = false),
|
||||
accountProviderDataSource: AccountProviderDataSource = AccountProviderDataSource(),
|
||||
matrixAuthenticationService: MatrixAuthenticationService = FakeAuthenticationService(),
|
||||
matrixAuthenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService(),
|
||||
defaultOidcActionFlow: DefaultOidcActionFlow = DefaultOidcActionFlow(),
|
||||
defaultLoginUserStory: DefaultLoginUserStory = DefaultLoginUserStory(),
|
||||
) = ConfirmAccountProviderPresenter(
|
||||
|
||||
@@ -30,7 +30,7 @@ import io.element.android.libraries.matrix.test.A_PASSWORD
|
||||
import io.element.android.libraries.matrix.test.A_SESSION_ID
|
||||
import io.element.android.libraries.matrix.test.A_THROWABLE
|
||||
import io.element.android.libraries.matrix.test.A_USER_NAME
|
||||
import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService
|
||||
import io.element.android.tests.testutils.WarmUpRule
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Rule
|
||||
@@ -42,7 +42,7 @@ class LoginPasswordPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - initial state`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val accountProviderDataSource = AccountProviderDataSource()
|
||||
val loginUserStory = DefaultLoginUserStory()
|
||||
val presenter = LoginPasswordPresenter(
|
||||
@@ -63,7 +63,7 @@ class LoginPasswordPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - enter login and password`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val accountProviderDataSource = AccountProviderDataSource()
|
||||
val loginUserStory = DefaultLoginUserStory()
|
||||
val presenter = LoginPasswordPresenter(
|
||||
@@ -89,7 +89,7 @@ class LoginPasswordPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - submit`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val accountProviderDataSource = AccountProviderDataSource()
|
||||
val loginUserStory = DefaultLoginUserStory().apply { setLoginFlowIsDone(false) }
|
||||
val presenter = LoginPasswordPresenter(
|
||||
@@ -118,7 +118,7 @@ class LoginPasswordPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - submit with error`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val accountProviderDataSource = AccountProviderDataSource()
|
||||
val loginUserStory = DefaultLoginUserStory()
|
||||
val presenter = LoginPasswordPresenter(
|
||||
@@ -146,7 +146,7 @@ class LoginPasswordPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - clear error`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val accountProviderDataSource = AccountProviderDataSource()
|
||||
val loginUserStory = DefaultLoginUserStory()
|
||||
val presenter = LoginPasswordPresenter(
|
||||
|
||||
@@ -29,7 +29,7 @@ import io.element.android.features.login.impl.resolver.network.WellKnownBaseConf
|
||||
import io.element.android.features.login.impl.resolver.network.WellKnownSlidingSyncConfig
|
||||
import io.element.android.libraries.architecture.AsyncData
|
||||
import io.element.android.libraries.matrix.test.A_HOMESERVER_URL
|
||||
import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService
|
||||
import io.element.android.tests.testutils.WarmUpRule
|
||||
import io.element.android.tests.testutils.testCoroutineDispatchers
|
||||
import kotlinx.coroutines.test.runTest
|
||||
@@ -44,7 +44,7 @@ class SearchAccountProviderPresenterTest {
|
||||
fun `present - initial state`() = runTest {
|
||||
val fakeWellknownRequest = FakeWellknownRequest()
|
||||
val changeServerPresenter = ChangeServerPresenter(
|
||||
FakeAuthenticationService(),
|
||||
FakeMatrixAuthenticationService(),
|
||||
AccountProviderDataSource()
|
||||
)
|
||||
val presenter = SearchAccountProviderPresenter(
|
||||
@@ -64,7 +64,7 @@ class SearchAccountProviderPresenterTest {
|
||||
fun `present - enter text no result`() = runTest {
|
||||
val fakeWellknownRequest = FakeWellknownRequest()
|
||||
val changeServerPresenter = ChangeServerPresenter(
|
||||
FakeAuthenticationService(),
|
||||
FakeMatrixAuthenticationService(),
|
||||
AccountProviderDataSource()
|
||||
)
|
||||
val presenter = SearchAccountProviderPresenter(
|
||||
@@ -88,7 +88,7 @@ class SearchAccountProviderPresenterTest {
|
||||
fun `present - enter valid url no wellknown`() = runTest {
|
||||
val fakeWellknownRequest = FakeWellknownRequest()
|
||||
val changeServerPresenter = ChangeServerPresenter(
|
||||
FakeAuthenticationService(),
|
||||
FakeMatrixAuthenticationService(),
|
||||
AccountProviderDataSource()
|
||||
)
|
||||
val presenter = SearchAccountProviderPresenter(
|
||||
@@ -123,7 +123,7 @@ class SearchAccountProviderPresenterTest {
|
||||
)
|
||||
)
|
||||
val changeServerPresenter = ChangeServerPresenter(
|
||||
FakeAuthenticationService(),
|
||||
FakeMatrixAuthenticationService(),
|
||||
AccountProviderDataSource()
|
||||
)
|
||||
val presenter = SearchAccountProviderPresenter(
|
||||
@@ -158,7 +158,7 @@ class SearchAccountProviderPresenterTest {
|
||||
)
|
||||
)
|
||||
val changeServerPresenter = ChangeServerPresenter(
|
||||
FakeAuthenticationService(),
|
||||
FakeMatrixAuthenticationService(),
|
||||
AccountProviderDataSource()
|
||||
)
|
||||
val presenter = SearchAccountProviderPresenter(
|
||||
|
||||
@@ -28,7 +28,7 @@ import io.element.android.libraries.matrix.test.A_HOMESERVER
|
||||
import io.element.android.libraries.matrix.test.A_HOMESERVER_URL
|
||||
import io.element.android.libraries.matrix.test.A_THROWABLE
|
||||
import io.element.android.libraries.matrix.test.A_USER_ID
|
||||
import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.core.aBuildMeta
|
||||
import io.element.android.tests.testutils.WarmUpRule
|
||||
import kotlinx.coroutines.test.runTest
|
||||
@@ -41,7 +41,7 @@ class WaitListPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - initial state`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService().apply {
|
||||
val authenticationService = FakeMatrixAuthenticationService().apply {
|
||||
givenHomeserver(A_HOMESERVER)
|
||||
}
|
||||
val loginUserStory = DefaultLoginUserStory()
|
||||
@@ -63,7 +63,7 @@ class WaitListPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - attempt login with error`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService().apply {
|
||||
val authenticationService = FakeMatrixAuthenticationService().apply {
|
||||
givenLoginError(A_THROWABLE)
|
||||
}
|
||||
val loginUserStory = DefaultLoginUserStory()
|
||||
@@ -94,7 +94,7 @@ class WaitListPresenterTest {
|
||||
|
||||
@Test
|
||||
fun `present - attempt login with success`() = runTest {
|
||||
val authenticationService = FakeAuthenticationService()
|
||||
val authenticationService = FakeMatrixAuthenticationService()
|
||||
val loginUserStory = DefaultLoginUserStory().apply { setLoginFlowIsDone(false) }
|
||||
val presenter = WaitListPresenter(
|
||||
LoginFormState.Default,
|
||||
|
||||
@@ -31,7 +31,7 @@ import kotlinx.coroutines.flow.flowOf
|
||||
|
||||
val A_OIDC_DATA = OidcDetails(url = "a-url")
|
||||
|
||||
class FakeAuthenticationService(
|
||||
class FakeMatrixAuthenticationService(
|
||||
private val matrixClientResult: ((SessionId) -> Result<MatrixClient>)? = null
|
||||
) : MatrixAuthenticationService {
|
||||
private val homeserver = MutableStateFlow<MatrixHomeServerDetails?>(null)
|
||||
@@ -28,7 +28,7 @@ import io.element.android.libraries.matrix.test.AN_EVENT_ID
|
||||
import io.element.android.libraries.matrix.test.A_ROOM_ID
|
||||
import io.element.android.libraries.matrix.test.A_SECRET
|
||||
import io.element.android.libraries.matrix.test.A_USER_ID
|
||||
import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.core.aBuildMeta
|
||||
import io.element.android.libraries.push.impl.notifications.FakeNotifiableEventResolver
|
||||
import io.element.android.libraries.push.impl.notifications.fixtures.aNotifiableMessageEvent
|
||||
@@ -135,7 +135,7 @@ class DefaultPushHandlerTest {
|
||||
pushClientSecret = FakePushClientSecret(
|
||||
getUserIdFromSecretResult = { null }
|
||||
),
|
||||
matrixAuthenticationService = FakeAuthenticationService().apply {
|
||||
matrixAuthenticationService = FakeMatrixAuthenticationService().apply {
|
||||
getLatestSessionIdLambda = { A_USER_ID }
|
||||
},
|
||||
incrementPushCounterResult = incrementPushCounterResult
|
||||
@@ -171,7 +171,7 @@ class DefaultPushHandlerTest {
|
||||
pushClientSecret = FakePushClientSecret(
|
||||
getUserIdFromSecretResult = { null }
|
||||
),
|
||||
matrixAuthenticationService = FakeAuthenticationService().apply {
|
||||
matrixAuthenticationService = FakeMatrixAuthenticationService().apply {
|
||||
getLatestSessionIdLambda = { null }
|
||||
},
|
||||
incrementPushCounterResult = incrementPushCounterResult
|
||||
@@ -247,7 +247,7 @@ class DefaultPushHandlerTest {
|
||||
userPushStore: UserPushStore = FakeUserPushStore(),
|
||||
pushClientSecret: PushClientSecret = FakePushClientSecret(),
|
||||
buildMeta: BuildMeta = aBuildMeta(),
|
||||
matrixAuthenticationService: MatrixAuthenticationService = FakeAuthenticationService(),
|
||||
matrixAuthenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService(),
|
||||
diagnosticPushHandler: DiagnosticPushHandler = DiagnosticPushHandler(),
|
||||
): DefaultPushHandler {
|
||||
return DefaultPushHandler(
|
||||
|
||||
@@ -25,7 +25,7 @@ import io.element.android.libraries.matrix.test.A_USER_ID
|
||||
import io.element.android.libraries.matrix.test.A_USER_ID_2
|
||||
import io.element.android.libraries.matrix.test.A_USER_ID_3
|
||||
import io.element.android.libraries.matrix.test.FakeMatrixClient
|
||||
import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService
|
||||
import io.element.android.libraries.push.test.FakePusherSubscriber
|
||||
import io.element.android.libraries.pushproviders.api.PusherSubscriber
|
||||
import io.element.android.libraries.pushstore.api.UserPushStoreFactory
|
||||
@@ -66,7 +66,7 @@ class DefaultFirebaseNewTokenHandlerTest {
|
||||
storeData(aSessionData(A_USER_ID_2))
|
||||
storeData(aSessionData(A_USER_ID_3))
|
||||
},
|
||||
matrixAuthenticationService = FakeAuthenticationService(
|
||||
matrixAuthenticationService = FakeMatrixAuthenticationService(
|
||||
matrixClientResult = { sessionId ->
|
||||
when (sessionId) {
|
||||
A_USER_ID -> Result.success(aMatrixClient1)
|
||||
@@ -105,7 +105,7 @@ class DefaultFirebaseNewTokenHandlerTest {
|
||||
sessionStore = InMemoryMultiSessionsStore().apply {
|
||||
storeData(aSessionData(A_USER_ID))
|
||||
},
|
||||
matrixAuthenticationService = FakeAuthenticationService(
|
||||
matrixAuthenticationService = FakeMatrixAuthenticationService(
|
||||
matrixClientResult = { _ ->
|
||||
Result.failure(IllegalStateException())
|
||||
}
|
||||
@@ -131,7 +131,7 @@ class DefaultFirebaseNewTokenHandlerTest {
|
||||
sessionStore = InMemoryMultiSessionsStore().apply {
|
||||
storeData(aSessionData(A_USER_ID))
|
||||
},
|
||||
matrixAuthenticationService = FakeAuthenticationService(
|
||||
matrixAuthenticationService = FakeMatrixAuthenticationService(
|
||||
matrixClientResult = { _ ->
|
||||
Result.success(aMatrixClient1)
|
||||
}
|
||||
@@ -154,7 +154,7 @@ class DefaultFirebaseNewTokenHandlerTest {
|
||||
pusherSubscriber: PusherSubscriber = FakePusherSubscriber(),
|
||||
sessionStore: SessionStore = InMemorySessionStore(),
|
||||
userPushStoreFactory: UserPushStoreFactory = FakeUserPushStoreFactory(),
|
||||
matrixAuthenticationService: MatrixAuthenticationService = FakeAuthenticationService(),
|
||||
matrixAuthenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService(),
|
||||
firebaseStore: FirebaseStore = InMemoryFirebaseStore(),
|
||||
): FirebaseNewTokenHandler {
|
||||
return DefaultFirebaseNewTokenHandler(
|
||||
|
||||
@@ -22,7 +22,7 @@ import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.A_SECRET
|
||||
import io.element.android.libraries.matrix.test.A_USER_ID
|
||||
import io.element.android.libraries.matrix.test.FakeMatrixClient
|
||||
import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService
|
||||
import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService
|
||||
import io.element.android.libraries.push.test.FakePusherSubscriber
|
||||
import io.element.android.libraries.pushproviders.api.PusherSubscriber
|
||||
import io.element.android.libraries.pushstore.api.UserPushStoreFactory
|
||||
@@ -86,7 +86,7 @@ class DefaultUnifiedPushNewGatewayHandlerTest {
|
||||
pusherSubscriber = FakePusherSubscriber(
|
||||
registerPusherResult = { _, _, _ -> Result.failure(IllegalStateException("an error")) }
|
||||
),
|
||||
matrixAuthenticationService = FakeAuthenticationService(matrixClientResult = { Result.success(aMatrixClient) }),
|
||||
matrixAuthenticationService = FakeMatrixAuthenticationService(matrixClientResult = { Result.success(aMatrixClient) }),
|
||||
)
|
||||
val result = defaultUnifiedPushNewGatewayHandler.handle(
|
||||
endpoint = "aEndpoint",
|
||||
@@ -114,7 +114,7 @@ class DefaultUnifiedPushNewGatewayHandlerTest {
|
||||
pusherSubscriber = FakePusherSubscriber(
|
||||
registerPusherResult = lambda
|
||||
),
|
||||
matrixAuthenticationService = FakeAuthenticationService(matrixClientResult = { Result.success(aMatrixClient) }),
|
||||
matrixAuthenticationService = FakeMatrixAuthenticationService(matrixClientResult = { Result.success(aMatrixClient) }),
|
||||
)
|
||||
val result = defaultUnifiedPushNewGatewayHandler.handle(
|
||||
endpoint = "aEndpoint",
|
||||
@@ -131,7 +131,7 @@ class DefaultUnifiedPushNewGatewayHandlerTest {
|
||||
pusherSubscriber: PusherSubscriber = FakePusherSubscriber(),
|
||||
userPushStoreFactory: UserPushStoreFactory = FakeUserPushStoreFactory(),
|
||||
pushClientSecret: PushClientSecret = FakePushClientSecret(),
|
||||
matrixAuthenticationService: MatrixAuthenticationService = FakeAuthenticationService()
|
||||
matrixAuthenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService()
|
||||
): DefaultUnifiedPushNewGatewayHandler {
|
||||
return DefaultUnifiedPushNewGatewayHandler(
|
||||
pusherSubscriber = pusherSubscriber,
|
||||
|
||||
Reference in New Issue
Block a user