mirror of
https://github.com/bitwarden/android.git
synced 2026-11-19 17:40:12 -06:00
Create policy manager (#899)
This commit is contained in:
committed by
Álison Fernandes
parent
794b68d364
commit
d538e37606
@@ -70,6 +70,7 @@ import com.x8bit.bitwarden.data.auth.repository.util.toUserState
|
||||
import com.x8bit.bitwarden.data.auth.repository.util.toUserStateJson
|
||||
import com.x8bit.bitwarden.data.auth.util.toSdkParams
|
||||
import com.x8bit.bitwarden.data.platform.base.FakeDispatcherManager
|
||||
import com.x8bit.bitwarden.data.platform.manager.PolicyManager
|
||||
import com.x8bit.bitwarden.data.platform.manager.PushManager
|
||||
import com.x8bit.bitwarden.data.platform.manager.dispatcher.DispatcherManager
|
||||
import com.x8bit.bitwarden.data.platform.repository.SettingsRepository
|
||||
@@ -79,6 +80,7 @@ import com.x8bit.bitwarden.data.platform.repository.util.bufferedMutableSharedFl
|
||||
import com.x8bit.bitwarden.data.platform.util.asFailure
|
||||
import com.x8bit.bitwarden.data.platform.util.asSuccess
|
||||
import com.x8bit.bitwarden.data.vault.datasource.network.model.PolicyTypeJson
|
||||
import com.x8bit.bitwarden.data.vault.datasource.network.model.SyncResponseJson
|
||||
import com.x8bit.bitwarden.data.vault.datasource.network.model.createMockOrganization
|
||||
import com.x8bit.bitwarden.data.vault.datasource.network.model.createMockPolicy
|
||||
import com.x8bit.bitwarden.data.vault.datasource.sdk.VaultSdkSource
|
||||
@@ -194,10 +196,16 @@ class AuthRepositoryTest {
|
||||
|
||||
private val mutableLogoutFlow = bufferedMutableSharedFlow<Unit>()
|
||||
private val mutableSyncOrgKeysFlow = bufferedMutableSharedFlow<Unit>()
|
||||
private val mutableActivePolicyFlow = bufferedMutableSharedFlow<List<SyncResponseJson.Policy>>()
|
||||
private val pushManager: PushManager = mockk {
|
||||
every { logoutFlow } returns mutableLogoutFlow
|
||||
every { syncOrgKeysFlow } returns mutableSyncOrgKeysFlow
|
||||
}
|
||||
private val policyManager: PolicyManager = mockk {
|
||||
every {
|
||||
getActivePoliciesFlow(type = PolicyTypeJson.MASTER_PASSWORD)
|
||||
} returns mutableActivePolicyFlow
|
||||
}
|
||||
|
||||
private var elapsedRealtimeMillis = 123456789L
|
||||
|
||||
@@ -219,6 +227,7 @@ class AuthRepositoryTest {
|
||||
userLogoutManager = userLogoutManager,
|
||||
dispatcherManager = dispatcherManager,
|
||||
pushManager = pushManager,
|
||||
policyManager = policyManager,
|
||||
elapsedRealtimeMillisProvider = { elapsedRealtimeMillis },
|
||||
)
|
||||
|
||||
@@ -406,9 +415,8 @@ class AuthRepositoryTest {
|
||||
val result = repository.login(email = EMAIL, password = PASSWORD, captchaToken = null)
|
||||
|
||||
// Set policies that will fail the password.
|
||||
fakeAuthDiskSource.storePolicies(
|
||||
userId = USER_ID_1,
|
||||
policies = listOf(
|
||||
mutableActivePolicyFlow.emit(
|
||||
listOf(
|
||||
createMockPolicy(
|
||||
type = PolicyTypeJson.MASTER_PASSWORD,
|
||||
isEnabled = true,
|
||||
@@ -509,38 +517,6 @@ class AuthRepositoryTest {
|
||||
assertNull(repository.rememberedOrgIdentifier)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `hasExportVaultPoliciesEnabled checks if any export vault policies are enabled`() {
|
||||
fakeAuthDiskSource.userState = SINGLE_USER_STATE_1
|
||||
|
||||
// No stored policies returns false.
|
||||
assertFalse(repository.hasExportVaultPoliciesEnabled)
|
||||
|
||||
// Stored but disabled policies returns false.
|
||||
fakeAuthDiskSource.storePolicies(
|
||||
userId = USER_ID_1,
|
||||
policies = listOf(
|
||||
createMockPolicy(
|
||||
type = PolicyTypeJson.DISABLE_PERSONAL_VAULT_EXPORT,
|
||||
isEnabled = false,
|
||||
),
|
||||
),
|
||||
)
|
||||
assertFalse(repository.hasExportVaultPoliciesEnabled)
|
||||
|
||||
// Stored enabled policies returns true.
|
||||
fakeAuthDiskSource.storePolicies(
|
||||
userId = USER_ID_1,
|
||||
policies = listOf(
|
||||
createMockPolicy(
|
||||
type = PolicyTypeJson.DISABLE_PERSONAL_VAULT_EXPORT,
|
||||
isEnabled = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
assertTrue(repository.hasExportVaultPoliciesEnabled)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `passwordResetReason should pull from the user's profile in AuthDiskSource`() = runTest {
|
||||
val updatedProfile = ACCOUNT_1.profile.copy(
|
||||
@@ -3702,7 +3678,7 @@ class AuthRepositoryTest {
|
||||
fun `validatePasswordAgainstPolicy validates password against policy requirements`() = runTest {
|
||||
fakeAuthDiskSource.userState = SINGLE_USER_STATE_1
|
||||
|
||||
// A helper method to set a policy in the store with the given parameters.
|
||||
// A helper method to set a policy with the given parameters.
|
||||
fun setPolicy(
|
||||
minLength: Int = 0,
|
||||
minComplexity: Int? = null,
|
||||
@@ -3711,22 +3687,21 @@ class AuthRepositoryTest {
|
||||
requireNumbers: Boolean = false,
|
||||
requireSpecial: Boolean = false,
|
||||
) {
|
||||
fakeAuthDiskSource.storePolicies(
|
||||
userId = USER_ID_1,
|
||||
policies = listOf(
|
||||
createMockPolicy(
|
||||
type = PolicyTypeJson.MASTER_PASSWORD,
|
||||
isEnabled = true,
|
||||
data = buildJsonObject {
|
||||
put(key = "minLength", value = minLength)
|
||||
put(key = "minComplexity", value = minComplexity)
|
||||
put(key = "requireUpper", value = requireUpper)
|
||||
put(key = "requireLower", value = requireLower)
|
||||
put(key = "requireNumbers", value = requireNumbers)
|
||||
put(key = "requireSpecial", value = requireSpecial)
|
||||
put(key = "enforceOnLogin", value = true)
|
||||
},
|
||||
),
|
||||
every {
|
||||
policyManager.getActivePolicies(type = PolicyTypeJson.MASTER_PASSWORD)
|
||||
} returns listOf(
|
||||
createMockPolicy(
|
||||
type = PolicyTypeJson.MASTER_PASSWORD,
|
||||
isEnabled = true,
|
||||
data = buildJsonObject {
|
||||
put(key = "minLength", value = minLength)
|
||||
put(key = "minComplexity", value = minComplexity)
|
||||
put(key = "requireUpper", value = requireUpper)
|
||||
put(key = "requireLower", value = requireLower)
|
||||
put(key = "requireNumbers", value = requireNumbers)
|
||||
put(key = "requireSpecial", value = requireSpecial)
|
||||
put(key = "enforceOnLogin", value = true)
|
||||
},
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
-34
@@ -8,7 +8,6 @@ import com.x8bit.bitwarden.data.auth.datasource.disk.util.FakeAuthDiskSource
|
||||
import com.x8bit.bitwarden.data.auth.repository.model.Organization
|
||||
import com.x8bit.bitwarden.data.auth.repository.model.UserOrganizations
|
||||
import com.x8bit.bitwarden.data.vault.datasource.network.model.createMockOrganization
|
||||
import com.x8bit.bitwarden.data.vault.datasource.network.model.createMockPolicy
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import kotlinx.coroutines.test.runTest
|
||||
@@ -155,37 +154,4 @@ class AuthDiskSourceExtensionsTest {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `currentUserPoliciesListFlow should emit changes to current user's policy data`() =
|
||||
runTest {
|
||||
val userId = "userId1"
|
||||
val userStateJson = mockk<UserStateJson>() {
|
||||
every { activeUserId } returns userId
|
||||
}
|
||||
authDiskSource.apply {
|
||||
userState = userStateJson
|
||||
storePolicies(
|
||||
userId = userId,
|
||||
policies = listOf(createMockPolicy()),
|
||||
)
|
||||
}
|
||||
|
||||
authDiskSource.currentUserPoliciesListFlow.test {
|
||||
assertEquals(
|
||||
listOf(createMockPolicy()),
|
||||
awaitItem(),
|
||||
)
|
||||
|
||||
authDiskSource.storePolicies(
|
||||
userId = userId,
|
||||
policies = listOf(createMockPolicy(number = 3)),
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
listOf(createMockPolicy(number = 3)),
|
||||
awaitItem(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.x8bit.bitwarden.data.platform.manager
|
||||
|
||||
import app.cash.turbine.test
|
||||
import com.x8bit.bitwarden.data.auth.datasource.disk.AuthDiskSource
|
||||
import com.x8bit.bitwarden.data.auth.datasource.disk.model.UserStateJson
|
||||
import com.x8bit.bitwarden.data.vault.datasource.network.model.PolicyTypeJson
|
||||
import com.x8bit.bitwarden.data.vault.datasource.network.model.SyncResponseJson
|
||||
import com.x8bit.bitwarden.data.vault.datasource.network.model.createMockOrganization
|
||||
import com.x8bit.bitwarden.data.vault.datasource.network.model.createMockPolicy
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class PolicyManagerTest {
|
||||
private val mutableUserStateFlow = MutableStateFlow<UserStateJson?>(null)
|
||||
private val mutablePolicyFlow = MutableStateFlow<List<SyncResponseJson.Policy>?>(null)
|
||||
private val authDiskSource: AuthDiskSource = mockk {
|
||||
every { userStateFlow } returns mutableUserStateFlow
|
||||
every { getPoliciesFlow(USER_ID) } returns mutablePolicyFlow
|
||||
}
|
||||
|
||||
private lateinit var policyManager: PolicyManager
|
||||
|
||||
@BeforeEach
|
||||
fun setUp() {
|
||||
policyManager = PolicyManagerImpl(
|
||||
authDiskSource = authDiskSource,
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `currentUserPoliciesListFlow should emit changes to current user's policy data`() =
|
||||
runTest {
|
||||
val userStateJson = mockk<UserStateJson> {
|
||||
every { activeUserId } returns USER_ID
|
||||
}
|
||||
val organizationsOne = createMockOrganization(
|
||||
number = 1,
|
||||
isEnabled = true,
|
||||
shouldUsePolicies = true,
|
||||
)
|
||||
val organizationsTwo = createMockOrganization(
|
||||
number = 2,
|
||||
isEnabled = true,
|
||||
shouldUsePolicies = true,
|
||||
)
|
||||
val expectedPolicyOne = createMockPolicy(
|
||||
isEnabled = true,
|
||||
number = 1,
|
||||
organizationId = organizationsOne.id,
|
||||
type = PolicyTypeJson.MAXIMUM_VAULT_TIMEOUT,
|
||||
)
|
||||
val expectedPolicyTwo = createMockPolicy(
|
||||
isEnabled = true,
|
||||
number = 2,
|
||||
organizationId = organizationsTwo.id,
|
||||
type = PolicyTypeJson.MAXIMUM_VAULT_TIMEOUT,
|
||||
)
|
||||
every {
|
||||
authDiskSource.getOrganizations(USER_ID)
|
||||
} returns listOf(organizationsOne) andThen listOf(organizationsTwo)
|
||||
|
||||
mutableUserStateFlow.value = userStateJson
|
||||
mutablePolicyFlow.value = listOf(expectedPolicyOne)
|
||||
|
||||
policyManager
|
||||
.getActivePoliciesFlow(type = PolicyTypeJson.MAXIMUM_VAULT_TIMEOUT)
|
||||
.test {
|
||||
assertEquals(listOf(expectedPolicyOne), awaitItem())
|
||||
|
||||
mutablePolicyFlow.value = listOf(expectedPolicyTwo)
|
||||
|
||||
assertEquals(listOf(expectedPolicyTwo), awaitItem())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `getActivePolicies returns empty list if user id is null`() {
|
||||
every {
|
||||
authDiskSource.userState
|
||||
} returns null
|
||||
|
||||
assertTrue(policyManager.getActivePolicies(type = PolicyTypeJson.MASTER_PASSWORD).isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `getActivePolicies returns empty list if the policies are not active`() {
|
||||
val userState: UserStateJson = mockk {
|
||||
every { activeUserId } returns USER_ID
|
||||
}
|
||||
every { authDiskSource.userState } returns userState
|
||||
every {
|
||||
authDiskSource.getOrganizations(USER_ID)
|
||||
} returns listOf(
|
||||
createMockOrganization(
|
||||
number = 3,
|
||||
isEnabled = true,
|
||||
),
|
||||
)
|
||||
every {
|
||||
authDiskSource.getPolicies(USER_ID)
|
||||
} returns listOf(
|
||||
createMockPolicy(
|
||||
organizationId = "mockId-3",
|
||||
isEnabled = true,
|
||||
),
|
||||
)
|
||||
|
||||
assertTrue(policyManager.getActivePolicies(type = PolicyTypeJson.MASTER_PASSWORD).isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `getActivePolicies returns active and applied policies`() {
|
||||
val userState: UserStateJson = mockk {
|
||||
every { activeUserId } returns USER_ID
|
||||
}
|
||||
every { authDiskSource.userState } returns userState
|
||||
every {
|
||||
authDiskSource.getOrganizations(USER_ID)
|
||||
} returns listOf(
|
||||
createMockOrganization(
|
||||
number = 3,
|
||||
isEnabled = false,
|
||||
),
|
||||
)
|
||||
every {
|
||||
authDiskSource.getPolicies(USER_ID)
|
||||
} returns listOf(
|
||||
createMockPolicy(
|
||||
organizationId = "mockId-3",
|
||||
isEnabled = true,
|
||||
),
|
||||
)
|
||||
|
||||
assertTrue(policyManager.getActivePolicies(type = PolicyTypeJson.MASTER_PASSWORD).isEmpty())
|
||||
}
|
||||
}
|
||||
|
||||
private const val USER_ID = "userId"
|
||||
+26
-24
@@ -19,6 +19,7 @@ import com.x8bit.bitwarden.data.auth.datasource.network.model.TrustedDeviceUserD
|
||||
import com.x8bit.bitwarden.data.auth.datasource.network.model.UserDecryptionOptionsJson
|
||||
import com.x8bit.bitwarden.data.auth.repository.model.PolicyInformation
|
||||
import com.x8bit.bitwarden.data.platform.base.FakeDispatcherManager
|
||||
import com.x8bit.bitwarden.data.platform.manager.PolicyManager
|
||||
import com.x8bit.bitwarden.data.platform.repository.model.LocalDataState
|
||||
import com.x8bit.bitwarden.data.tools.generator.datasource.disk.GeneratorDiskSource
|
||||
import com.x8bit.bitwarden.data.tools.generator.datasource.disk.PasswordHistoryDiskSource
|
||||
@@ -72,6 +73,7 @@ class GeneratorRepositoryTest {
|
||||
private val passwordHistoryDiskSource: PasswordHistoryDiskSource = mockk()
|
||||
private val vaultSdkSource: VaultSdkSource = mockk()
|
||||
private val dispatcherManager = FakeDispatcherManager()
|
||||
private val policyManager: PolicyManager = mockk()
|
||||
|
||||
private val repository = GeneratorRepositoryImpl(
|
||||
generatorSdkSource = generatorSdkSource,
|
||||
@@ -80,6 +82,7 @@ class GeneratorRepositoryTest {
|
||||
passwordHistoryDiskSource = passwordHistoryDiskSource,
|
||||
vaultSdkSource = vaultSdkSource,
|
||||
dispatcherManager = dispatcherManager,
|
||||
policyManager = policyManager,
|
||||
)
|
||||
|
||||
@AfterEach
|
||||
@@ -769,35 +772,35 @@ class GeneratorRepositoryTest {
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `getPasswordGeneratorPolicy returns default settings when no policies are present`() = runTest {
|
||||
val userId = "testUserId"
|
||||
coEvery { authDiskSource.userState?.activeUserId } returns userId
|
||||
coEvery { authDiskSource.getPolicies(userId) } returns emptyList()
|
||||
fun `getPasswordGeneratorPolicy returns default settings when no policies are present`() =
|
||||
runTest {
|
||||
every {
|
||||
policyManager.getActivePolicies(type = PolicyTypeJson.PASSWORD_GENERATOR)
|
||||
} returns emptyList()
|
||||
|
||||
val policy = repository.getPasswordGeneratorPolicy()
|
||||
val policy = repository.getPasswordGeneratorPolicy()
|
||||
|
||||
val expectedPolicy = PolicyInformation.PasswordGenerator(
|
||||
defaultType = "password",
|
||||
minLength = null,
|
||||
useUpper = false,
|
||||
useLower = false,
|
||||
useNumbers = false,
|
||||
useSpecial = false,
|
||||
minNumbers = null,
|
||||
minSpecial = null,
|
||||
minNumberWords = null,
|
||||
capitalize = false,
|
||||
includeNumber = false,
|
||||
)
|
||||
val expectedPolicy = PolicyInformation.PasswordGenerator(
|
||||
defaultType = "password",
|
||||
minLength = null,
|
||||
useUpper = false,
|
||||
useLower = false,
|
||||
useNumbers = false,
|
||||
useSpecial = false,
|
||||
minNumbers = null,
|
||||
minSpecial = null,
|
||||
minNumberWords = null,
|
||||
capitalize = false,
|
||||
includeNumber = false,
|
||||
)
|
||||
|
||||
assertNotNull(policy)
|
||||
assertEquals(expectedPolicy, policy)
|
||||
}
|
||||
assertNotNull(policy)
|
||||
assertEquals(expectedPolicy, policy)
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `getPasswordGeneratorPolicy applies strictest settings from multiple policies`() = runTest {
|
||||
val userId = "testUserId"
|
||||
val policy1 = PolicyInformation.PasswordGenerator(
|
||||
defaultType = "password",
|
||||
minLength = 8,
|
||||
@@ -840,8 +843,7 @@ class GeneratorRepositoryTest {
|
||||
organizationId = "id2",
|
||||
),
|
||||
)
|
||||
coEvery { authDiskSource.userState?.activeUserId } returns userId
|
||||
coEvery { authDiskSource.getPolicies(userId) } returns policies
|
||||
every { policyManager.getActivePolicies(type = PolicyTypeJson.PASSWORD_GENERATOR) } returns policies
|
||||
|
||||
val resultPolicy = repository.getPasswordGeneratorPolicy()
|
||||
|
||||
|
||||
+2
-1
@@ -7,12 +7,13 @@ import kotlinx.serialization.json.JsonObject
|
||||
*/
|
||||
fun createMockPolicy(
|
||||
number: Int = 1,
|
||||
organizationId: String = "mockOrganizationId-$number",
|
||||
type: PolicyTypeJson = PolicyTypeJson.MASTER_PASSWORD,
|
||||
isEnabled: Boolean = false,
|
||||
data: JsonObject? = null,
|
||||
): SyncResponseJson.Policy =
|
||||
SyncResponseJson.Policy(
|
||||
organizationId = "mockOrganizationId-$number",
|
||||
organizationId = organizationId,
|
||||
id = "mockId-$number",
|
||||
type = type,
|
||||
isEnabled = isEnabled,
|
||||
|
||||
+9
-5
@@ -30,13 +30,17 @@ fun createMockProfile(number: Int): SyncResponseJson.Profile =
|
||||
/**
|
||||
* Create a mock [SyncResponseJson.Profile.Organization] with a given [number].
|
||||
*/
|
||||
fun createMockOrganization(number: Int): SyncResponseJson.Profile.Organization =
|
||||
fun createMockOrganization(
|
||||
number: Int,
|
||||
isEnabled: Boolean = false,
|
||||
shouldUsePolicies: Boolean = false,
|
||||
): SyncResponseJson.Profile.Organization =
|
||||
SyncResponseJson.Profile.Organization(
|
||||
shouldUsePolicies = false,
|
||||
shouldUsePolicies = shouldUsePolicies,
|
||||
keyConnectorUrl = "mockKeyConnectorUrl-$number",
|
||||
type = 1,
|
||||
type = OrganizationType.ADMIN,
|
||||
seats = 1,
|
||||
isEnabled = false,
|
||||
isEnabled = isEnabled,
|
||||
providerType = 1,
|
||||
maxCollections = 1,
|
||||
isSelfHost = false,
|
||||
@@ -60,7 +64,7 @@ fun createMockOrganization(number: Int): SyncResponseJson.Profile.Organization =
|
||||
name = "mockName-$number",
|
||||
shouldUseApi = false,
|
||||
familySponsorshipValidUntil = ZonedDateTime.parse("2023-10-27T12:00:00Z"),
|
||||
status = 1,
|
||||
status = OrganizationStatusType.ACCEPTED,
|
||||
)
|
||||
|
||||
/**
|
||||
|
||||
+13
-3
@@ -5,6 +5,9 @@ import app.cash.turbine.test
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.data.auth.repository.AuthRepository
|
||||
import com.x8bit.bitwarden.data.auth.repository.model.ValidatePasswordResult
|
||||
import com.x8bit.bitwarden.data.platform.manager.PolicyManager
|
||||
import com.x8bit.bitwarden.data.vault.datasource.network.model.PolicyTypeJson
|
||||
import com.x8bit.bitwarden.data.vault.datasource.network.model.createMockPolicy
|
||||
import com.x8bit.bitwarden.ui.platform.base.BaseViewModelTest
|
||||
import com.x8bit.bitwarden.ui.platform.base.util.asText
|
||||
import com.x8bit.bitwarden.ui.platform.feature.settings.exportvault.model.ExportVaultFormat
|
||||
@@ -16,15 +19,21 @@ import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ExportVaultViewModelTest : BaseViewModelTest() {
|
||||
private val authRepository: AuthRepository = mockk {
|
||||
every { hasExportVaultPoliciesEnabled } returns false
|
||||
private val authRepository: AuthRepository = mockk()
|
||||
|
||||
private val policyManager: PolicyManager = mockk {
|
||||
every {
|
||||
getActivePolicies(type = PolicyTypeJson.DISABLE_PERSONAL_VAULT_EXPORT)
|
||||
} returns emptyList()
|
||||
}
|
||||
|
||||
private val savedStateHandle = SavedStateHandle()
|
||||
|
||||
@Test
|
||||
fun `initial state should be correct`() = runTest {
|
||||
every { authRepository.hasExportVaultPoliciesEnabled } returns true
|
||||
every {
|
||||
policyManager.getActivePolicies(type = PolicyTypeJson.DISABLE_PERSONAL_VAULT_EXPORT)
|
||||
} returns listOf(createMockPolicy())
|
||||
|
||||
val viewModel = createViewModel()
|
||||
viewModel.stateFlow.test {
|
||||
@@ -185,6 +194,7 @@ class ExportVaultViewModelTest : BaseViewModelTest() {
|
||||
private fun createViewModel(): ExportVaultViewModel =
|
||||
ExportVaultViewModel(
|
||||
authRepository = authRepository,
|
||||
policyManager = policyManager,
|
||||
savedStateHandle = savedStateHandle,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user