Merge pull request #7151 from thundernest/add_servercertificate_module

Add servercertificate module
This commit is contained in:
Wolf-Martell Montwé 2023-09-04 10:08:31 +02:00 committed by GitHub
commit ae1ffdb4f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 180 additions and 103 deletions

View file

@ -0,0 +1,18 @@
plugins {
id(ThunderbirdPlugins.Library.androidCompose)
}
android {
namespace = "app.k9mail.feature.account.servercertificate"
resourcePrefix = "account_servercertificate_"
}
dependencies {
implementation(projects.core.ui.compose.designsystem)
implementation(projects.core.common)
implementation(projects.feature.account.common)
implementation(projects.mail.common)
testImplementation(projects.core.ui.compose.testing)
}

View file

@ -0,0 +1,29 @@
package app.k9mail.feature.account.servercertificate
import app.k9mail.feature.account.servercertificate.data.InMemoryServerCertificateErrorRepository
import app.k9mail.feature.account.servercertificate.domain.AccountServerCertificateDomainContract
import app.k9mail.feature.account.servercertificate.domain.usecase.AddServerCertificateException
import app.k9mail.feature.account.servercertificate.ui.AccountServerCertificateErrorViewModel
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.core.module.Module
import org.koin.dsl.module
val featureAccountServerCertificateModule: Module = module {
single<AccountServerCertificateDomainContract.ServerCertificateErrorRepository> {
InMemoryServerCertificateErrorRepository()
}
factory<AccountServerCertificateDomainContract.UseCase.AddServerCertificateException> {
AddServerCertificateException(
localKeyStore = get(),
)
}
viewModel {
AccountServerCertificateErrorViewModel(
certificateErrorRepository = get(),
addServerCertificateException = get(),
)
}
}

View file

@ -0,0 +1,21 @@
package app.k9mail.feature.account.servercertificate.data
import app.k9mail.feature.account.servercertificate.domain.AccountServerCertificateDomainContract
import app.k9mail.feature.account.servercertificate.domain.entity.ServerCertificateError
class InMemoryServerCertificateErrorRepository(
private var serverCertificateError: ServerCertificateError? = null,
) : AccountServerCertificateDomainContract.ServerCertificateErrorRepository {
override fun getCertificateError(): ServerCertificateError? {
return serverCertificateError
}
override fun setCertificateError(serverCertificateError: ServerCertificateError) {
this.serverCertificateError = serverCertificateError
}
override fun clearCertificateError() {
serverCertificateError = null
}
}

View file

@ -0,0 +1,21 @@
package app.k9mail.feature.account.servercertificate.domain
import app.k9mail.feature.account.servercertificate.domain.entity.ServerCertificateError
import java.security.cert.X509Certificate
interface AccountServerCertificateDomainContract {
interface ServerCertificateErrorRepository {
fun getCertificateError(): ServerCertificateError?
fun setCertificateError(serverCertificateError: ServerCertificateError)
fun clearCertificateError()
}
interface UseCase {
fun interface AddServerCertificateException {
suspend fun addCertificate(hostname: String, port: Int, certificate: X509Certificate?)
}
}
}

View file

@ -1,8 +1,8 @@
package app.k9mail.feature.account.setup.domain.entity
package app.k9mail.feature.account.servercertificate.domain.entity
import java.security.cert.X509Certificate
data class CertificateError(
data class ServerCertificateError(
val hostname: String,
val port: Int,
val certificateChain: List<X509Certificate>,

View file

@ -1,6 +1,6 @@
package app.k9mail.feature.account.setup.domain.usecase
package app.k9mail.feature.account.servercertificate.domain.usecase
import app.k9mail.feature.account.setup.domain.DomainContract
import app.k9mail.feature.account.servercertificate.domain.AccountServerCertificateDomainContract.UseCase
import com.fsck.k9.mail.ssl.LocalKeyStore
import java.security.cert.X509Certificate
import kotlinx.coroutines.CoroutineDispatcher
@ -10,7 +10,7 @@ import kotlinx.coroutines.withContext
internal class AddServerCertificateException(
private val localKeyStore: LocalKeyStore,
private val coroutineDispatcher: CoroutineDispatcher = Dispatchers.IO,
) : DomainContract.UseCase.AddServerCertificateException {
) : UseCase.AddServerCertificateException {
override suspend fun addCertificate(hostname: String, port: Int, certificate: X509Certificate?) {
withContext(coroutineDispatcher) {
localKeyStore.addCertificate(hostname, port, certificate)

View file

@ -1,8 +1,8 @@
package app.k9mail.feature.account.setup.ui.servercertificate
package app.k9mail.feature.account.servercertificate.ui
import app.k9mail.core.ui.compose.common.mvi.UnidirectionalViewModel
interface CertificateErrorContract {
interface AccountServerCertificateErrorContract {
interface ViewModel : UnidirectionalViewModel<State, Event, Effect>

View file

@ -1,4 +1,4 @@
package app.k9mail.feature.account.setup.ui.servercertificate
package app.k9mail.feature.account.servercertificate.ui
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Column
@ -21,11 +21,11 @@ import app.k9mail.core.ui.compose.designsystem.template.ResponsiveWidthContainer
import app.k9mail.core.ui.compose.designsystem.template.Scaffold
import app.k9mail.core.ui.compose.theme.K9Theme
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.feature.account.setup.data.InMemoryCertificateErrorRepository
import app.k9mail.feature.account.setup.domain.entity.CertificateError
import app.k9mail.feature.account.setup.ui.servercertificate.CertificateErrorContract.Effect
import app.k9mail.feature.account.setup.ui.servercertificate.CertificateErrorContract.Event
import app.k9mail.feature.account.setup.ui.servercertificate.CertificateErrorContract.ViewModel
import app.k9mail.feature.account.servercertificate.data.InMemoryServerCertificateErrorRepository
import app.k9mail.feature.account.servercertificate.domain.entity.ServerCertificateError
import app.k9mail.feature.account.servercertificate.ui.AccountServerCertificateErrorContract.Effect
import app.k9mail.feature.account.servercertificate.ui.AccountServerCertificateErrorContract.Event
import app.k9mail.feature.account.servercertificate.ui.AccountServerCertificateErrorContract.ViewModel
import java.security.cert.CertificateFactory
import java.security.cert.X509Certificate
import org.koin.androidx.compose.koinViewModel
@ -33,11 +33,11 @@ import org.koin.androidx.compose.koinViewModel
// Note: This is a placeholder with mostly hardcoded text.
// TODO: Replace with final design.
@Composable
internal fun CertificateErrorScreen(
fun CertificateErrorScreen(
onCertificateAccepted: () -> Unit,
onBack: () -> Unit,
modifier: Modifier = Modifier,
viewModel: ViewModel = koinViewModel<CertificateErrorViewModel>(),
viewModel: ViewModel = koinViewModel<AccountServerCertificateErrorViewModel>(),
) {
val (state, dispatch) = viewModel.observe { effect ->
when (effect) {
@ -138,7 +138,7 @@ internal fun CertificateErrorScreenK9Preview() {
val certificateFactory = CertificateFactory.getInstance("X.509")
val certificate = certificateFactory.generateCertificate(inputStream) as X509Certificate
val certificateError = CertificateError(
val serverCertificateError = ServerCertificateError(
hostname = "mail.domain.example",
port = 143,
certificateChain = listOf(certificate),
@ -148,9 +148,9 @@ internal fun CertificateErrorScreenK9Preview() {
CertificateErrorScreen(
onCertificateAccepted = {},
onBack = {},
viewModel = CertificateErrorViewModel(
viewModel = AccountServerCertificateErrorViewModel(
addServerCertificateException = { _, _, _ -> },
certificateErrorRepository = InMemoryCertificateErrorRepository(certificateError),
certificateErrorRepository = InMemoryServerCertificateErrorRepository(serverCertificateError),
),
)
}

View file

@ -1,13 +1,13 @@
package app.k9mail.feature.account.setup.ui.servercertificate
package app.k9mail.feature.account.servercertificate.ui
import androidx.lifecycle.viewModelScope
import app.k9mail.core.ui.compose.common.mvi.BaseViewModel
import app.k9mail.feature.account.setup.domain.DomainContract.CertificateErrorRepository
import app.k9mail.feature.account.setup.domain.DomainContract.UseCase.AddServerCertificateException
import app.k9mail.feature.account.setup.domain.entity.CertificateError
import app.k9mail.feature.account.setup.ui.servercertificate.CertificateErrorContract.Effect
import app.k9mail.feature.account.setup.ui.servercertificate.CertificateErrorContract.Event
import app.k9mail.feature.account.setup.ui.servercertificate.CertificateErrorContract.State
import app.k9mail.feature.account.servercertificate.domain.AccountServerCertificateDomainContract
import app.k9mail.feature.account.servercertificate.domain.AccountServerCertificateDomainContract.UseCase
import app.k9mail.feature.account.servercertificate.domain.entity.ServerCertificateError
import app.k9mail.feature.account.servercertificate.ui.AccountServerCertificateErrorContract.Effect
import app.k9mail.feature.account.servercertificate.ui.AccountServerCertificateErrorContract.Event
import app.k9mail.feature.account.servercertificate.ui.AccountServerCertificateErrorContract.State
import com.fsck.k9.logging.Timber
import com.fsck.k9.mail.filter.Hex
import java.security.MessageDigest
@ -15,15 +15,15 @@ import java.security.NoSuchAlgorithmException
import java.security.cert.CertificateEncodingException
import kotlinx.coroutines.launch
class CertificateErrorViewModel(
private val certificateErrorRepository: CertificateErrorRepository,
private val addServerCertificateException: AddServerCertificateException,
class AccountServerCertificateErrorViewModel(
private val certificateErrorRepository: AccountServerCertificateDomainContract.ServerCertificateErrorRepository,
private val addServerCertificateException: UseCase.AddServerCertificateException,
initialState: State = State(),
) : BaseViewModel<State, Event, Effect>(initialState), CertificateErrorContract.ViewModel {
private val certificateError: CertificateError? = certificateErrorRepository.getCertificateError()
) : BaseViewModel<State, Event, Effect>(initialState), AccountServerCertificateErrorContract.ViewModel {
private val serverCertificateError: ServerCertificateError? = certificateErrorRepository.getCertificateError()
init {
setErrorMessage(buildErrorMessage(certificateError))
setErrorMessage(buildErrorMessage(serverCertificateError))
}
override fun event(event: Event) {
@ -34,7 +34,7 @@ class CertificateErrorViewModel(
}
private fun acceptCertificate() {
val certificateError = requireNotNull(certificateError)
val certificateError = requireNotNull(serverCertificateError)
viewModelScope.launch {
addServerCertificateException.addCertificate(
@ -56,8 +56,8 @@ class CertificateErrorViewModel(
emitEffect(Effect.NavigateCertificateAccepted)
}
private fun buildErrorMessage(certificateError: CertificateError?): String {
val certificate = certificateError?.certificateChain?.firstOrNull() ?: return ""
private fun buildErrorMessage(serverCertificateError: ServerCertificateError?): String {
val certificate = serverCertificateError?.certificateChain?.firstOrNull() ?: return ""
return buildString {
certificate.subjectAlternativeNames?.let { subjectAlternativeNames ->

View file

@ -0,0 +1,35 @@
package app.k9mail.feature.account.servercertificate
import app.k9mail.feature.account.servercertificate.ui.AccountServerCertificateErrorContract
import com.fsck.k9.mail.ssl.LocalKeyStore
import org.junit.Test
import org.koin.core.annotation.KoinExperimentalAPI
import org.koin.core.module.Module
import org.koin.dsl.koinApplication
import org.koin.dsl.module
import org.koin.test.KoinTest
import org.koin.test.check.checkModules
import org.koin.test.verify.verify
import org.mockito.Mockito
class AccountServerCertificateModuleKtTest : KoinTest {
private val externalModule: Module = module {
single<LocalKeyStore> { Mockito.mock() }
}
@OptIn(KoinExperimentalAPI::class)
@Test
fun `should have a valid di module`() {
featureAccountServerCertificateModule.verify(
extraTypes = listOf(
AccountServerCertificateErrorContract.State::class,
),
)
koinApplication {
modules(externalModule, featureAccountServerCertificateModule)
checkModules()
}
}
}

View file

@ -19,14 +19,17 @@ android {
dependencies {
implementation(projects.core.ui.compose.designsystem)
implementation(projects.core.common)
implementation(projects.mail.common)
implementation(projects.mail.protocols.imap)
implementation(projects.mail.protocols.pop3)
implementation(projects.mail.protocols.smtp)
implementation(projects.feature.autodiscovery.service)
api(projects.feature.account.common)
implementation(projects.feature.account.oauth)
implementation(projects.feature.account.servercertificate)
testImplementation(projects.core.ui.compose.testing)
}

View file

@ -4,9 +4,8 @@ import app.k9mail.autodiscovery.api.AutoDiscoveryService
import app.k9mail.autodiscovery.service.RealAutoDiscoveryService
import app.k9mail.feature.account.common.featureAccountCommonModule
import app.k9mail.feature.account.oauth.featureAccountOAuthModule
import app.k9mail.feature.account.setup.data.InMemoryCertificateErrorRepository
import app.k9mail.feature.account.servercertificate.featureAccountServerCertificateModule
import app.k9mail.feature.account.setup.domain.DomainContract
import app.k9mail.feature.account.setup.domain.usecase.AddServerCertificateException
import app.k9mail.feature.account.setup.domain.usecase.CreateAccount
import app.k9mail.feature.account.setup.domain.usecase.GetAutoDiscovery
import app.k9mail.feature.account.setup.domain.usecase.ValidateServerSettings
@ -23,7 +22,6 @@ import app.k9mail.feature.account.setup.ui.options.AccountOptionsViewModel
import app.k9mail.feature.account.setup.ui.outgoing.AccountOutgoingConfigContract
import app.k9mail.feature.account.setup.ui.outgoing.AccountOutgoingConfigValidator
import app.k9mail.feature.account.setup.ui.outgoing.AccountOutgoingConfigViewModel
import app.k9mail.feature.account.setup.ui.servercertificate.CertificateErrorViewModel
import app.k9mail.feature.account.setup.ui.validation.AccountValidationViewModel
import com.fsck.k9.mail.store.imap.ImapServerSettingsValidator
import com.fsck.k9.mail.store.pop3.Pop3ServerSettingsValidator
@ -35,7 +33,7 @@ import org.koin.core.qualifier.named
import org.koin.dsl.module
val featureAccountSetupModule: Module = module {
includes(featureAccountCommonModule, featureAccountOAuthModule)
includes(featureAccountCommonModule, featureAccountOAuthModule, featureAccountServerCertificateModule)
single<OkHttpClient> {
OkHttpClient()
@ -54,8 +52,6 @@ val featureAccountSetupModule: Module = module {
)
}
single<DomainContract.CertificateErrorRepository> { InMemoryCertificateErrorRepository() }
factory<DomainContract.UseCase.ValidateServerSettings> {
ValidateServerSettings(
authStateStorage = get(),
@ -74,12 +70,6 @@ val featureAccountSetupModule: Module = module {
)
}
factory<DomainContract.UseCase.AddServerCertificateException> {
AddServerCertificateException(
localKeyStore = get(),
)
}
factory<DomainContract.UseCase.CreateAccount> {
CreateAccount(
accountCreator = get(),
@ -143,12 +133,6 @@ val featureAccountSetupModule: Module = module {
accountStateRepository = get(),
)
}
viewModel {
CertificateErrorViewModel(
certificateErrorRepository = get(),
addServerCertificateException = get(),
)
}
}
internal const val NAME_INCOMING_VALIDATION = "incoming_validation"

View file

@ -1,21 +0,0 @@
package app.k9mail.feature.account.setup.data
import app.k9mail.feature.account.setup.domain.DomainContract
import app.k9mail.feature.account.setup.domain.entity.CertificateError
class InMemoryCertificateErrorRepository(
private var certificateError: CertificateError? = null,
) : DomainContract.CertificateErrorRepository {
override fun getCertificateError(): CertificateError? {
return certificateError
}
override fun setCertificateError(certificateError: CertificateError) {
this.certificateError = certificateError
}
override fun clearCertificateError() {
certificateError = null
}
}

View file

@ -3,21 +3,12 @@ package app.k9mail.feature.account.setup.domain
import app.k9mail.autodiscovery.api.AutoDiscoveryResult
import app.k9mail.core.common.domain.usecase.validation.ValidationResult
import app.k9mail.feature.account.common.domain.entity.AccountOptions
import app.k9mail.feature.account.setup.domain.entity.CertificateError
import com.fsck.k9.mail.ServerSettings
import com.fsck.k9.mail.server.ServerSettingsValidationResult
import java.security.cert.X509Certificate
interface DomainContract {
interface CertificateErrorRepository {
fun getCertificateError(): CertificateError?
fun setCertificateError(certificateError: CertificateError)
fun clearCertificateError()
}
interface UseCase {
fun interface GetAutoDiscovery {
suspend fun execute(emailAddress: String): AutoDiscoveryResult

View file

@ -1,6 +0,0 @@
package app.k9mail.feature.account.setup.domain.entity
import com.fsck.k9.mail.AuthType
import com.fsck.k9.mail.ServerSettings
fun ServerSettings?.isOAuth() = this?.authenticationType == AuthType.XOAUTH2

View file

@ -13,8 +13,8 @@ import app.k9mail.feature.account.common.ui.WizardNavigationBar
import app.k9mail.feature.account.common.ui.WizardNavigationBarState
import app.k9mail.feature.account.common.ui.preview.PreviewAccountStateRepository
import app.k9mail.feature.account.oauth.ui.preview.PreviewAccountOAuthViewModel
import app.k9mail.feature.account.servercertificate.data.InMemoryServerCertificateErrorRepository
import app.k9mail.feature.account.setup.R
import app.k9mail.feature.account.setup.data.InMemoryCertificateErrorRepository
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract.Event
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract.ViewModel
import com.fsck.k9.mail.server.ServerSettingsValidationResult
@ -65,7 +65,7 @@ internal fun AccountIncomingValidationScreenK9Preview() {
},
accountStateRepository = PreviewAccountStateRepository(),
authorizationStateRepository = { true },
certificateErrorRepository = InMemoryCertificateErrorRepository(),
certificateErrorRepository = InMemoryServerCertificateErrorRepository(),
oAuthViewModel = PreviewAccountOAuthViewModel(),
isIncomingValidation = true,
),
@ -84,7 +84,7 @@ internal fun AccountIncomingValidationScreenThunderbirdPreview() {
},
accountStateRepository = PreviewAccountStateRepository(),
authorizationStateRepository = { true },
certificateErrorRepository = InMemoryCertificateErrorRepository(),
certificateErrorRepository = InMemoryServerCertificateErrorRepository(),
oAuthViewModel = PreviewAccountOAuthViewModel(),
isIncomingValidation = true,
),
@ -103,7 +103,7 @@ internal fun AccountOutgoingValidationScreenK9Preview() {
},
accountStateRepository = PreviewAccountStateRepository(),
authorizationStateRepository = { true },
certificateErrorRepository = InMemoryCertificateErrorRepository(),
certificateErrorRepository = InMemoryServerCertificateErrorRepository(),
oAuthViewModel = PreviewAccountOAuthViewModel(),
isIncomingValidation = false,
),
@ -122,7 +122,7 @@ internal fun AccountOutgoingValidationScreenThunderbirdPreview() {
},
accountStateRepository = PreviewAccountStateRepository(),
authorizationStateRepository = { true },
certificateErrorRepository = InMemoryCertificateErrorRepository(),
certificateErrorRepository = InMemoryServerCertificateErrorRepository(),
oAuthViewModel = PreviewAccountOAuthViewModel(),
isIncomingValidation = false,
),

View file

@ -5,7 +5,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
import app.k9mail.core.ui.compose.common.mvi.observe
import app.k9mail.feature.account.setup.ui.servercertificate.CertificateErrorScreen
import app.k9mail.feature.account.servercertificate.ui.CertificateErrorScreen
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract.Effect
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract.Event
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract.ViewModel

View file

@ -5,10 +5,11 @@ import app.k9mail.core.ui.compose.common.mvi.BaseViewModel
import app.k9mail.feature.account.common.domain.AccountDomainContract
import app.k9mail.feature.account.oauth.domain.AccountOAuthDomainContract
import app.k9mail.feature.account.oauth.domain.entity.OAuthResult
import app.k9mail.feature.account.oauth.domain.entity.isOAuth
import app.k9mail.feature.account.oauth.ui.AccountOAuthContract
import app.k9mail.feature.account.servercertificate.domain.AccountServerCertificateDomainContract
import app.k9mail.feature.account.servercertificate.domain.entity.ServerCertificateError
import app.k9mail.feature.account.setup.domain.DomainContract
import app.k9mail.feature.account.setup.domain.entity.CertificateError
import app.k9mail.feature.account.setup.domain.entity.isOAuth
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract.Effect
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract.Error
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract.Event
@ -25,7 +26,7 @@ internal class AccountValidationViewModel(
private val validateServerSettings: DomainContract.UseCase.ValidateServerSettings,
private val accountStateRepository: AccountDomainContract.AccountStateRepository,
private val authorizationStateRepository: AccountOAuthDomainContract.AuthorizationStateRepository,
private val certificateErrorRepository: DomainContract.CertificateErrorRepository,
private val certificateErrorRepository: AccountServerCertificateDomainContract.ServerCertificateErrorRepository,
override val oAuthViewModel: AccountOAuthContract.ViewModel,
override val isIncomingValidation: Boolean = true,
initialState: State? = null,
@ -169,7 +170,7 @@ internal class AccountValidationViewModel(
val serverSettings = checkNotNull(state.value.serverSettings)
certificateErrorRepository.setCertificateError(
CertificateError(
ServerCertificateError(
hostname = serverSettings.host!!,
port = serverSettings.port,
certificateChain = error.certificateChain,

View file

@ -4,6 +4,7 @@ import android.content.Context
import app.k9mail.core.common.oauth.OAuthConfigurationFactory
import app.k9mail.feature.account.common.domain.entity.AccountState
import app.k9mail.feature.account.oauth.ui.AccountOAuthContract
import app.k9mail.feature.account.servercertificate.ui.AccountServerCertificateErrorContract
import app.k9mail.feature.account.setup.AccountSetupExternalContract.AccountCreator
import app.k9mail.feature.account.setup.AccountSetupExternalContract.AccountCreator.AccountCreatorResult
import app.k9mail.feature.account.setup.ui.AccountSetupContract
@ -11,7 +12,6 @@ import app.k9mail.feature.account.setup.ui.autodiscovery.AccountAutoDiscoveryCon
import app.k9mail.feature.account.setup.ui.incoming.AccountIncomingConfigContract
import app.k9mail.feature.account.setup.ui.options.AccountOptionsContract
import app.k9mail.feature.account.setup.ui.outgoing.AccountOutgoingConfigContract
import app.k9mail.feature.account.setup.ui.servercertificate.CertificateErrorContract
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract
import com.fsck.k9.mail.oauth.AuthStateStorage
import com.fsck.k9.mail.oauth.OAuth2TokenProvider
@ -69,7 +69,7 @@ class AccountSetupModuleKtTest : KoinTest {
AccountOutgoingConfigContract.State::class,
AccountOptionsContract.State::class,
AccountState::class,
CertificateErrorContract.State::class,
AccountServerCertificateErrorContract.State::class,
AuthStateStorage::class,
Context::class,
Boolean::class,

View file

@ -5,7 +5,7 @@ import app.k9mail.core.ui.compose.testing.mvi.assertThatAndMviTurbinesConsumed
import app.k9mail.core.ui.compose.testing.mvi.turbinesWithInitialStateCheck
import app.k9mail.feature.account.common.data.InMemoryAccountStateRepository
import app.k9mail.feature.account.common.domain.entity.AccountState
import app.k9mail.feature.account.setup.data.InMemoryCertificateErrorRepository
import app.k9mail.feature.account.servercertificate.data.InMemoryServerCertificateErrorRepository
import app.k9mail.feature.account.setup.ui.FakeAccountOAuthViewModel
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract.Effect
import app.k9mail.feature.account.setup.ui.validation.AccountValidationContract.Error
@ -199,7 +199,7 @@ class AccountValidationViewModelTest {
},
accountStateRepository = InMemoryAccountStateRepository(),
authorizationStateRepository = { true },
certificateErrorRepository = InMemoryCertificateErrorRepository(),
certificateErrorRepository = InMemoryServerCertificateErrorRepository(),
oAuthViewModel = FakeAccountOAuthViewModel(),
initialState = initialState,
)
@ -238,7 +238,7 @@ class AccountValidationViewModelTest {
},
accountStateRepository = InMemoryAccountStateRepository(accountState),
authorizationStateRepository = { true },
certificateErrorRepository = InMemoryCertificateErrorRepository(),
certificateErrorRepository = InMemoryServerCertificateErrorRepository(),
oAuthViewModel = FakeAccountOAuthViewModel(),
initialState = initialState,
)

View file

@ -46,6 +46,7 @@ include(
include(
":feature:account:common",
":feature:account:oauth",
":feature:account:servercertificate",
":feature:account:setup",
)