mirror of
https://github.com/bitwarden/android.git
synced 2026-11-19 17:40:12 -06:00
BIT-2291: Bypass master password reprompt when user has no password (#1301)
This commit is contained in:
committed by
Álison Fernandes
parent
b730330196
commit
0a03df75cc
@@ -541,6 +541,7 @@ class SearchScreenTest : BaseComposeTest() {
|
||||
SearchAction.OverflowOptionClick(
|
||||
overflowAction = ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = "mockId-1",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -579,6 +580,7 @@ class SearchScreenTest : BaseComposeTest() {
|
||||
SearchAction.OverflowOptionClick(
|
||||
overflowAction = ListingItemOverflowAction.VaultAction.CopyPasswordClick(
|
||||
password = "mockPassword-1",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -675,6 +677,7 @@ class SearchScreenTest : BaseComposeTest() {
|
||||
masterPasswordRepromptData = MasterPasswordRepromptData.OverflowItem(
|
||||
action = ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = "mockId-1",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -882,6 +885,7 @@ private val DEFAULT_STATE: SearchState = SearchState(
|
||||
baseWebSendUrl = "www.test.com",
|
||||
baseIconUrl = "www.test.com",
|
||||
isIconLoadingDisabled = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
private fun createStateForAutofill(
|
||||
|
||||
+20
-3
@@ -477,6 +477,7 @@ class SearchViewModelTest : BaseViewModelTest() {
|
||||
masterPasswordRepromptData = MasterPasswordRepromptData.OverflowItem(
|
||||
action = ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = cipherId,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -665,7 +666,10 @@ class SearchViewModelTest : BaseViewModelTest() {
|
||||
val viewModel = createViewModel()
|
||||
viewModel.trySendAction(
|
||||
SearchAction.OverflowOptionClick(
|
||||
ListingItemOverflowAction.VaultAction.CopyNumberClick(number = number),
|
||||
ListingItemOverflowAction.VaultAction.CopyNumberClick(
|
||||
number = number,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
verify(exactly = 1) {
|
||||
@@ -726,7 +730,10 @@ class SearchViewModelTest : BaseViewModelTest() {
|
||||
val viewModel = createViewModel()
|
||||
viewModel.trySendAction(
|
||||
SearchAction.OverflowOptionClick(
|
||||
ListingItemOverflowAction.VaultAction.CopyPasswordClick(password = password),
|
||||
ListingItemOverflowAction.VaultAction.CopyPasswordClick(
|
||||
password = password,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
verify(exactly = 1) {
|
||||
@@ -744,6 +751,7 @@ class SearchViewModelTest : BaseViewModelTest() {
|
||||
SearchAction.OverflowOptionClick(
|
||||
ListingItemOverflowAction.VaultAction.CopySecurityCodeClick(
|
||||
securityCode = securityCode,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -777,7 +785,10 @@ class SearchViewModelTest : BaseViewModelTest() {
|
||||
viewModel.eventFlow.test {
|
||||
viewModel.trySendAction(
|
||||
SearchAction.OverflowOptionClick(
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = cipherId),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = cipherId,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
assertEquals(SearchEvent.NavigateToEditCipher(cipherId), awaitItem())
|
||||
@@ -834,6 +845,7 @@ class SearchViewModelTest : BaseViewModelTest() {
|
||||
baseIconUrl = "https://vault.bitwarden.com/icons",
|
||||
isIconLoadingDisabled = false,
|
||||
isAutofill = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
} returns expectedViewState
|
||||
val dataState = DataState.Loaded(
|
||||
@@ -934,6 +946,7 @@ class SearchViewModelTest : BaseViewModelTest() {
|
||||
baseIconUrl = "https://vault.bitwarden.com/icons",
|
||||
isIconLoadingDisabled = false,
|
||||
isAutofill = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
} returns expectedViewState
|
||||
mutableVaultDataStateFlow.tryEmit(
|
||||
@@ -1044,6 +1057,7 @@ class SearchViewModelTest : BaseViewModelTest() {
|
||||
baseIconUrl = "https://vault.bitwarden.com/icons",
|
||||
isIconLoadingDisabled = false,
|
||||
isAutofill = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
} returns expectedViewState
|
||||
val dataState = DataState.Error(
|
||||
@@ -1154,6 +1168,7 @@ class SearchViewModelTest : BaseViewModelTest() {
|
||||
baseIconUrl = "https://vault.bitwarden.com/icons",
|
||||
isIconLoadingDisabled = false,
|
||||
isAutofill = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
} returns expectedViewState
|
||||
val dataState = DataState.NoNetwork(
|
||||
@@ -1320,6 +1335,7 @@ class SearchViewModelTest : BaseViewModelTest() {
|
||||
baseIconUrl = "https://vault.bitwarden.com/icons",
|
||||
isIconLoadingDisabled = false,
|
||||
isAutofill = true,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
} returns expectedViewState
|
||||
val dataState = DataState.Loaded(
|
||||
@@ -1351,6 +1367,7 @@ private val DEFAULT_STATE: SearchState = SearchState(
|
||||
baseWebSendUrl = "https://vault.bitwarden.com/#/send/",
|
||||
baseIconUrl = "https://vault.bitwarden.com/icons",
|
||||
isIconLoadingDisabled = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
private val DEFAULT_USER_STATE = UserState(
|
||||
|
||||
+4
@@ -271,6 +271,7 @@ class SearchTypeDataExtensionsTest {
|
||||
baseIconUrl = "www.test.com",
|
||||
isIconLoadingDisabled = false,
|
||||
isAutofill = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(SearchState.ViewState.Empty(message = null), result)
|
||||
@@ -294,6 +295,7 @@ class SearchTypeDataExtensionsTest {
|
||||
baseIconUrl = "https://vault.bitwarden.com/icons",
|
||||
isIconLoadingDisabled = false,
|
||||
isAutofill = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -332,6 +334,7 @@ class SearchTypeDataExtensionsTest {
|
||||
baseIconUrl = "https://vault.bitwarden.com/icons",
|
||||
isIconLoadingDisabled = false,
|
||||
isAutofill = true,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -380,6 +383,7 @@ class SearchTypeDataExtensionsTest {
|
||||
baseIconUrl = "www.test.com",
|
||||
isIconLoadingDisabled = false,
|
||||
isAutofill = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
|
||||
+19
-4
@@ -42,12 +42,16 @@ fun createMockDisplayItemForCipher(
|
||||
),
|
||||
overflowOptions = listOf(
|
||||
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = "mockId-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyUsernameClick(
|
||||
username = "mockUsername-$number",
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyPasswordClick(
|
||||
password = "mockPassword-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyTotpClick(
|
||||
totpCode = "mockTotp-$number",
|
||||
@@ -85,7 +89,10 @@ fun createMockDisplayItemForCipher(
|
||||
),
|
||||
overflowOptions = listOf(
|
||||
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = "mockId-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyNoteClick(
|
||||
notes = "mockNotes-$number",
|
||||
),
|
||||
@@ -119,12 +126,17 @@ fun createMockDisplayItemForCipher(
|
||||
),
|
||||
overflowOptions = listOf(
|
||||
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = "mockId-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyNumberClick(
|
||||
number = "mockNumber-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopySecurityCodeClick(
|
||||
securityCode = "mockCode-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
overflowTestTag = "CipherOptionsButton",
|
||||
@@ -156,7 +168,10 @@ fun createMockDisplayItemForCipher(
|
||||
),
|
||||
overflowOptions = listOf(
|
||||
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = "mockId-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
overflowTestTag = "CipherOptionsButton",
|
||||
totpCode = null,
|
||||
|
||||
+81
-4
@@ -142,6 +142,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns DEFAULT_VIEW_STATE
|
||||
@@ -163,6 +164,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
}
|
||||
@@ -180,6 +182,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginState
|
||||
@@ -221,6 +224,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginState
|
||||
@@ -251,6 +255,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -292,6 +297,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -336,6 +342,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -374,6 +381,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
} returns DEFAULT_VIEW_STATE
|
||||
@@ -412,6 +420,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
} returns DEFAULT_VIEW_STATE
|
||||
@@ -459,6 +468,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
} returns DEFAULT_VIEW_STATE
|
||||
@@ -489,6 +499,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -521,6 +532,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -582,6 +594,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -633,6 +646,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -695,6 +709,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns DEFAULT_VIEW_STATE
|
||||
@@ -716,6 +731,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
}
|
||||
@@ -729,6 +745,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns createViewState(common = DEFAULT_COMMON.copy(requiresReprompt = false))
|
||||
@@ -744,6 +761,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
clipboardManager.setText(text = field)
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
}
|
||||
@@ -776,6 +794,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns DEFAULT_VIEW_STATE
|
||||
@@ -805,6 +824,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
}
|
||||
@@ -835,6 +855,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -864,6 +885,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
}
|
||||
@@ -877,6 +899,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns DEFAULT_VIEW_STATE
|
||||
@@ -898,6 +921,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
}
|
||||
@@ -915,6 +939,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -947,6 +972,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -970,6 +996,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
}
|
||||
@@ -991,6 +1018,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -1037,6 +1065,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns DEFAULT_VIEW_STATE
|
||||
@@ -1058,6 +1087,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
}
|
||||
@@ -1075,6 +1105,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -1104,6 +1135,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns DEFAULT_VIEW_STATE
|
||||
@@ -1125,6 +1157,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
}
|
||||
@@ -1142,6 +1175,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -1182,6 +1216,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -1236,6 +1271,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -1299,6 +1335,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -1475,6 +1512,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
} returns DEFAULT_VIEW_STATE
|
||||
@@ -1513,6 +1551,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
}
|
||||
@@ -1529,6 +1568,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
} returns DEFAULT_VIEW_STATE
|
||||
@@ -1553,6 +1593,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
}
|
||||
@@ -1565,6 +1606,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
} returns createViewState(common = DEFAULT_COMMON.copy(requiresReprompt = false))
|
||||
@@ -1581,6 +1623,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
clipboardManager.setText(text = DEFAULT_LOGIN_PASSWORD)
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
}
|
||||
@@ -1619,6 +1662,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
} returns createViewState(common = DEFAULT_COMMON.copy(requiresReprompt = false))
|
||||
@@ -1633,6 +1677,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
clipboardManager.setText(text = DEFAULT_LOGIN_USERNAME)
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
}
|
||||
@@ -1655,6 +1700,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
} returns DEFAULT_VIEW_STATE
|
||||
@@ -1677,6 +1723,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
}
|
||||
@@ -1690,6 +1737,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
}
|
||||
@@ -1714,6 +1762,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
}
|
||||
@@ -1728,6 +1777,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
} returns DEFAULT_VIEW_STATE
|
||||
@@ -1754,6 +1804,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
}
|
||||
@@ -1771,6 +1822,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
} returns loginViewState
|
||||
@@ -1800,6 +1852,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = createTotpCodeData(),
|
||||
)
|
||||
}
|
||||
@@ -1827,6 +1880,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns CARD_VIEW_STATE
|
||||
@@ -1850,6 +1904,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
}
|
||||
@@ -1862,6 +1917,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns createViewState(
|
||||
@@ -1879,6 +1935,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
clipboardManager.setText(text = "12345436")
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
}
|
||||
@@ -1892,6 +1949,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns CARD_VIEW_STATE
|
||||
@@ -1915,6 +1973,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
verify(exactly = 1) {
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
}
|
||||
@@ -1927,6 +1986,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
every {
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns createViewState(
|
||||
@@ -1944,6 +2004,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
clipboardManager.setText(text = "987")
|
||||
mockCipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
}
|
||||
@@ -1975,7 +2036,11 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
val viewState = mockk<VaultItemState.ViewState>()
|
||||
val cipherView = mockk<CipherView> {
|
||||
every {
|
||||
toViewState(isPremiumUser = true, totpCodeItemData = null)
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns viewState
|
||||
}
|
||||
val viewModel = createViewModel(state = null)
|
||||
@@ -2006,7 +2071,11 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
val viewState = mockk<VaultItemState.ViewState>()
|
||||
val cipherView = mockk<CipherView> {
|
||||
every {
|
||||
toViewState(isPremiumUser = true, totpCodeItemData = null)
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns viewState
|
||||
}
|
||||
val viewModel = createViewModel(state = null)
|
||||
@@ -2038,7 +2107,11 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
val viewState = mockk<VaultItemState.ViewState>()
|
||||
val cipherView = mockk<CipherView> {
|
||||
every {
|
||||
toViewState(isPremiumUser = true, totpCodeItemData = null)
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns viewState
|
||||
}
|
||||
val viewModel = createViewModel(state = null)
|
||||
@@ -2069,7 +2142,11 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
||||
val viewState = mockk<VaultItemState.ViewState>()
|
||||
val cipherView = mockk<CipherView> {
|
||||
every {
|
||||
toViewState(isPremiumUser = true, totpCodeItemData = null)
|
||||
toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
)
|
||||
} returns viewState
|
||||
}
|
||||
val viewModel = createViewModel(state = null)
|
||||
|
||||
+38
-1
@@ -16,12 +16,41 @@ class CipherViewExtensionsTest {
|
||||
ZoneOffset.UTC,
|
||||
)
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `toViewState should transform full CipherView into ViewState Login Content without master password reprompt`() {
|
||||
val cipherView = createCipherView(type = CipherType.LOGIN, isEmpty = false)
|
||||
val viewState = cipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = false,
|
||||
totpCodeItemData = TotpCodeItemData(
|
||||
periodSeconds = 30,
|
||||
timeLeftSeconds = 15,
|
||||
verificationCode = "123456",
|
||||
totpCode = "testCode",
|
||||
),
|
||||
clock = fixedClock,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
VaultItemState.ViewState.Content(
|
||||
common = createCommonContent(isEmpty = false, isPremiumUser = true).copy(
|
||||
currentCipher = cipherView,
|
||||
requiresReprompt = false,
|
||||
),
|
||||
type = createLoginContent(isEmpty = false),
|
||||
),
|
||||
viewState,
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `toViewState should transform full CipherView into ViewState Login Content with premium`() {
|
||||
val cipherView = createCipherView(type = CipherType.LOGIN, isEmpty = false)
|
||||
val viewState = cipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
TotpCodeItemData(
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = TotpCodeItemData(
|
||||
periodSeconds = 30,
|
||||
timeLeftSeconds = 15,
|
||||
verificationCode = "123456",
|
||||
@@ -47,6 +76,7 @@ class CipherViewExtensionsTest {
|
||||
val cipherView = createCipherView(type = CipherType.LOGIN, isEmpty = false)
|
||||
val viewState = cipherView.toViewState(
|
||||
isPremiumUser = isPremiumUser,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = TotpCodeItemData(
|
||||
periodSeconds = 30,
|
||||
timeLeftSeconds = 15,
|
||||
@@ -71,6 +101,7 @@ class CipherViewExtensionsTest {
|
||||
val cipherView = createCipherView(type = CipherType.LOGIN, isEmpty = true)
|
||||
val viewState = cipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
clock = fixedClock,
|
||||
)
|
||||
@@ -91,6 +122,7 @@ class CipherViewExtensionsTest {
|
||||
val cipherView = createCipherView(type = CipherType.IDENTITY, isEmpty = false)
|
||||
val viewState = cipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
clock = fixedClock,
|
||||
)
|
||||
@@ -110,6 +142,7 @@ class CipherViewExtensionsTest {
|
||||
val cipherView = createCipherView(type = CipherType.IDENTITY, isEmpty = true)
|
||||
val viewState = cipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
clock = fixedClock,
|
||||
)
|
||||
@@ -139,6 +172,7 @@ class CipherViewExtensionsTest {
|
||||
)
|
||||
val viewState = cipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
clock = fixedClock,
|
||||
)
|
||||
@@ -173,6 +207,7 @@ class CipherViewExtensionsTest {
|
||||
)
|
||||
val result = cipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
clock = fixedClock,
|
||||
)
|
||||
@@ -209,6 +244,7 @@ class CipherViewExtensionsTest {
|
||||
val cipherView = createCipherView(type = CipherType.SECURE_NOTE, isEmpty = false)
|
||||
val viewState = cipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
clock = fixedClock,
|
||||
)
|
||||
@@ -229,6 +265,7 @@ class CipherViewExtensionsTest {
|
||||
val cipherView = createCipherView(type = CipherType.SECURE_NOTE, isEmpty = true)
|
||||
val viewState = cipherView.toViewState(
|
||||
isPremiumUser = true,
|
||||
hasMasterPassword = true,
|
||||
totpCodeItemData = null,
|
||||
clock = fixedClock,
|
||||
)
|
||||
|
||||
+6
-1
@@ -1196,6 +1196,7 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
||||
VaultItemListingsAction.OverflowOptionClick(
|
||||
action = ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = "mockId-1",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -1508,6 +1509,7 @@ private val DEFAULT_STATE = VaultItemListingState(
|
||||
isPullToRefreshSettingEnabled = false,
|
||||
dialogState = null,
|
||||
policyDisablesSend = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
private val STATE_FOR_AUTOFILL = DEFAULT_STATE.copy(
|
||||
@@ -1567,7 +1569,10 @@ private fun createCipherDisplayItem(number: Int): VaultItemListingState.DisplayI
|
||||
iconData = IconData.Local(R.drawable.ic_vault),
|
||||
extraIconList = emptyList(),
|
||||
overflowOptions = listOf(
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = "mockId-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
optionsTestTag = "CipherOptionsButton",
|
||||
isAutofill = false,
|
||||
|
||||
+15
-3
@@ -448,6 +448,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
||||
masterPasswordRepromptData = MasterPasswordRepromptData.OverflowItem(
|
||||
action = ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = cipherId,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -688,7 +689,10 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
||||
val viewModel = createVaultItemListingViewModel()
|
||||
viewModel.trySendAction(
|
||||
VaultItemListingsAction.OverflowOptionClick(
|
||||
ListingItemOverflowAction.VaultAction.CopyNumberClick(number = number),
|
||||
ListingItemOverflowAction.VaultAction.CopyNumberClick(
|
||||
number = number,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
verify(exactly = 1) {
|
||||
@@ -704,7 +708,10 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
||||
val viewModel = createVaultItemListingViewModel()
|
||||
viewModel.trySendAction(
|
||||
VaultItemListingsAction.OverflowOptionClick(
|
||||
ListingItemOverflowAction.VaultAction.CopyPasswordClick(password = password),
|
||||
ListingItemOverflowAction.VaultAction.CopyPasswordClick(
|
||||
password = password,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
verify(exactly = 1) {
|
||||
@@ -722,6 +729,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
||||
VaultItemListingsAction.OverflowOptionClick(
|
||||
ListingItemOverflowAction.VaultAction.CopySecurityCodeClick(
|
||||
securityCode = securityCode,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -800,7 +808,10 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
||||
viewModel.eventFlow.test {
|
||||
viewModel.trySendAction(
|
||||
VaultItemListingsAction.OverflowOptionClick(
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = cipherId),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = cipherId,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
assertEquals(VaultItemListingEvent.NavigateToEditCipher(cipherId), awaitItem())
|
||||
@@ -1443,6 +1454,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
||||
autofillSelectionData = null,
|
||||
shouldFinishOnComplete = false,
|
||||
policyDisablesSend = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+8
@@ -393,6 +393,7 @@ class VaultItemListingDataExtensionsTest {
|
||||
isIconLoadingDisabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
autofillSelectionData = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -466,6 +467,7 @@ class VaultItemListingDataExtensionsTest {
|
||||
type = AutofillSelectionData.Type.LOGIN,
|
||||
uri = null,
|
||||
),
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -516,6 +518,7 @@ class VaultItemListingDataExtensionsTest {
|
||||
isIconLoadingDisabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
autofillSelectionData = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -533,6 +536,7 @@ class VaultItemListingDataExtensionsTest {
|
||||
isIconLoadingDisabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
autofillSelectionData = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -548,6 +552,7 @@ class VaultItemListingDataExtensionsTest {
|
||||
isIconLoadingDisabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
autofillSelectionData = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -566,6 +571,7 @@ class VaultItemListingDataExtensionsTest {
|
||||
type = AutofillSelectionData.Type.LOGIN,
|
||||
uri = "https://www.test.com",
|
||||
),
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -704,6 +710,7 @@ class VaultItemListingDataExtensionsTest {
|
||||
autofillSelectionData = null,
|
||||
itemListingType = VaultItemListingState.ItemListingType.Vault.Folder("1"),
|
||||
vaultFilterType = VaultFilterType.AllVaults,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -743,6 +750,7 @@ class VaultItemListingDataExtensionsTest {
|
||||
autofillSelectionData = null,
|
||||
itemListingType = VaultItemListingState.ItemListingType.Vault.Collection("mockId-1"),
|
||||
vaultFilterType = VaultFilterType.AllVaults,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
|
||||
+19
-4
@@ -43,12 +43,16 @@ fun createMockDisplayItemForCipher(
|
||||
),
|
||||
overflowOptions = listOf(
|
||||
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = "mockId-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyUsernameClick(
|
||||
username = "mockUsername-$number",
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyPasswordClick(
|
||||
password = "mockPassword-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyTotpClick(
|
||||
totpCode = "mockTotp-$number",
|
||||
@@ -86,7 +90,10 @@ fun createMockDisplayItemForCipher(
|
||||
),
|
||||
overflowOptions = listOf(
|
||||
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = "mockId-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyNoteClick(
|
||||
notes = "mockNotes-$number",
|
||||
),
|
||||
@@ -120,12 +127,17 @@ fun createMockDisplayItemForCipher(
|
||||
),
|
||||
overflowOptions = listOf(
|
||||
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = "mockId-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyNumberClick(
|
||||
number = "mockNumber-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopySecurityCodeClick(
|
||||
securityCode = "mockCode-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
optionsTestTag = "CipherOptionsButton",
|
||||
@@ -157,7 +169,10 @@ fun createMockDisplayItemForCipher(
|
||||
),
|
||||
overflowOptions = listOf(
|
||||
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = "mockId-$number"),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = "mockId-$number",
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
optionsTestTag = "CipherOptionsButton",
|
||||
isAutofill = false,
|
||||
|
||||
+38
-16
@@ -31,14 +31,20 @@ class CipherViewExtensionsTest {
|
||||
),
|
||||
)
|
||||
|
||||
val result = cipher.toOverflowActions()
|
||||
val result = cipher.toOverflowActions(hasMasterPassword = false)
|
||||
|
||||
assertEquals(
|
||||
listOf(
|
||||
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = id),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = id),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = id,
|
||||
requiresPasswordReprompt = false,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyUsernameClick(username = username),
|
||||
ListingItemOverflowAction.VaultAction.CopyPasswordClick(password = password),
|
||||
ListingItemOverflowAction.VaultAction.CopyPasswordClick(
|
||||
password = password,
|
||||
requiresPasswordReprompt = false,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyTotpClick(totpCode = totpCode),
|
||||
ListingItemOverflowAction.VaultAction.LaunchClick(url = uri),
|
||||
),
|
||||
@@ -63,12 +69,15 @@ class CipherViewExtensionsTest {
|
||||
),
|
||||
viewPassword = false,
|
||||
)
|
||||
val result = cipher.toOverflowActions()
|
||||
val result = cipher.toOverflowActions(hasMasterPassword = true)
|
||||
|
||||
assertEquals(
|
||||
listOf(
|
||||
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = id),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = id),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = id,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyUsernameClick(username = username),
|
||||
ListingItemOverflowAction.VaultAction.CopyTotpClick(totpCode = totpCode),
|
||||
ListingItemOverflowAction.VaultAction.LaunchClick(url = uri),
|
||||
@@ -95,7 +104,7 @@ class CipherViewExtensionsTest {
|
||||
),
|
||||
)
|
||||
|
||||
val result = cipher.toOverflowActions()
|
||||
val result = cipher.toOverflowActions(hasMasterPassword = true)
|
||||
|
||||
assertEquals(
|
||||
listOf(ListingItemOverflowAction.VaultAction.ViewClick(cipherId = id)),
|
||||
@@ -116,15 +125,22 @@ class CipherViewExtensionsTest {
|
||||
),
|
||||
)
|
||||
|
||||
val result = cipher.toOverflowActions()
|
||||
val result = cipher.toOverflowActions(hasMasterPassword = true)
|
||||
|
||||
assertEquals(
|
||||
listOf(
|
||||
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = id),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = id),
|
||||
ListingItemOverflowAction.VaultAction.CopyNumberClick(number = number),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = id,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyNumberClick(
|
||||
number = number,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopySecurityCodeClick(
|
||||
securityCode = securityCode,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
result,
|
||||
@@ -147,7 +163,7 @@ class CipherViewExtensionsTest {
|
||||
),
|
||||
)
|
||||
|
||||
val result = cipher.toOverflowActions()
|
||||
val result = cipher.toOverflowActions(hasMasterPassword = false)
|
||||
|
||||
assertEquals(
|
||||
listOf(ListingItemOverflowAction.VaultAction.ViewClick(cipherId = id)),
|
||||
@@ -163,12 +179,15 @@ class CipherViewExtensionsTest {
|
||||
identity = createMockIdentityView(number = 1),
|
||||
)
|
||||
|
||||
val result = cipher.toOverflowActions()
|
||||
val result = cipher.toOverflowActions(hasMasterPassword = false)
|
||||
|
||||
assertEquals(
|
||||
listOf(
|
||||
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = id),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = id),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = id,
|
||||
requiresPasswordReprompt = false,
|
||||
),
|
||||
),
|
||||
result,
|
||||
)
|
||||
@@ -187,7 +206,7 @@ class CipherViewExtensionsTest {
|
||||
identity = createMockIdentityView(number = 1),
|
||||
)
|
||||
|
||||
val result = cipher.toOverflowActions()
|
||||
val result = cipher.toOverflowActions(hasMasterPassword = true)
|
||||
|
||||
assertEquals(
|
||||
listOf(ListingItemOverflowAction.VaultAction.ViewClick(cipherId = id)),
|
||||
@@ -205,12 +224,15 @@ class CipherViewExtensionsTest {
|
||||
notes = notes,
|
||||
)
|
||||
|
||||
val result = cipher.toOverflowActions()
|
||||
val result = cipher.toOverflowActions(hasMasterPassword = true)
|
||||
|
||||
assertEquals(
|
||||
listOf(
|
||||
ListingItemOverflowAction.VaultAction.ViewClick(cipherId = id),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = id),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = id,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
ListingItemOverflowAction.VaultAction.CopyNoteClick(notes = notes),
|
||||
),
|
||||
result,
|
||||
@@ -231,7 +253,7 @@ class CipherViewExtensionsTest {
|
||||
notes = null,
|
||||
)
|
||||
|
||||
val result = cipher.toOverflowActions()
|
||||
val result = cipher.toOverflowActions(hasMasterPassword = false)
|
||||
|
||||
assertEquals(
|
||||
listOf(ListingItemOverflowAction.VaultAction.ViewClick(cipherId = id)),
|
||||
|
||||
@@ -1177,6 +1177,7 @@ private val DEFAULT_STATE: VaultState = VaultState(
|
||||
isPullToRefreshSettingEnabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
isIconLoadingDisabled = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
private val DEFAULT_CONTENT_VIEW_STATE: VaultState.ViewState.Content = VaultState.ViewState.Content(
|
||||
|
||||
@@ -476,6 +476,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
vaultFilterType = VaultFilterType.AllVaults,
|
||||
isIconLoadingDisabled = viewModel.stateFlow.value.isIconLoadingDisabled,
|
||||
baseIconUrl = viewModel.stateFlow.value.baseIconUrl,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
)
|
||||
.copy(
|
||||
@@ -499,6 +500,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
vaultFilterType = VaultFilterType.MyVault,
|
||||
isIconLoadingDisabled = viewModel.stateFlow.value.isIconLoadingDisabled,
|
||||
baseIconUrl = viewModel.stateFlow.value.baseIconUrl,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
viewModel.stateFlow.value,
|
||||
@@ -1186,7 +1188,10 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
val viewModel = createViewModel()
|
||||
viewModel.trySendAction(
|
||||
VaultAction.OverflowOptionClick(
|
||||
ListingItemOverflowAction.VaultAction.CopyNumberClick(number = number),
|
||||
ListingItemOverflowAction.VaultAction.CopyNumberClick(
|
||||
number = number,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
verify(exactly = 1) {
|
||||
@@ -1202,7 +1207,10 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
val viewModel = createViewModel()
|
||||
viewModel.trySendAction(
|
||||
VaultAction.OverflowOptionClick(
|
||||
ListingItemOverflowAction.VaultAction.CopyPasswordClick(password = password),
|
||||
ListingItemOverflowAction.VaultAction.CopyPasswordClick(
|
||||
password = password,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
verify(exactly = 1) {
|
||||
@@ -1265,6 +1273,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
VaultAction.OverflowOptionClick(
|
||||
ListingItemOverflowAction.VaultAction.CopySecurityCodeClick(
|
||||
securityCode = securityCode,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -1298,7 +1307,10 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
viewModel.eventFlow.test {
|
||||
viewModel.trySendAction(
|
||||
VaultAction.OverflowOptionClick(
|
||||
ListingItemOverflowAction.VaultAction.EditClick(cipherId = cipherId),
|
||||
ListingItemOverflowAction.VaultAction.EditClick(
|
||||
cipherId = cipherId,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
assertEquals(VaultEvent.NavigateToEditVaultItem(cipherId), awaitItem())
|
||||
@@ -1352,6 +1364,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
VaultAction.MasterPasswordRepromptSubmit(
|
||||
overflowAction = ListingItemOverflowAction.VaultAction.CopyPasswordClick(
|
||||
password = password,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
password = password,
|
||||
),
|
||||
@@ -1389,6 +1402,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
VaultAction.MasterPasswordRepromptSubmit(
|
||||
overflowAction = ListingItemOverflowAction.VaultAction.CopyPasswordClick(
|
||||
password = password,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
password = password,
|
||||
),
|
||||
@@ -1421,6 +1435,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||
VaultAction.MasterPasswordRepromptSubmit(
|
||||
overflowAction = ListingItemOverflowAction.VaultAction.CopyPasswordClick(
|
||||
password = password,
|
||||
requiresPasswordReprompt = true,
|
||||
),
|
||||
password = password,
|
||||
),
|
||||
@@ -1532,4 +1547,5 @@ private fun createMockVaultState(
|
||||
isPullToRefreshSettingEnabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
isIconLoadingDisabled = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
+10
@@ -55,6 +55,7 @@ class VaultDataExtensionsTest {
|
||||
isIconLoadingDisabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
vaultFilterType = VaultFilterType.AllVaults,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -115,6 +116,7 @@ class VaultDataExtensionsTest {
|
||||
isIconLoadingDisabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
vaultFilterType = VaultFilterType.MyVault,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -167,6 +169,7 @@ class VaultDataExtensionsTest {
|
||||
organizationId = "mockOrganizationId-1",
|
||||
organizationName = "Mock Organization 1",
|
||||
),
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -212,6 +215,7 @@ class VaultDataExtensionsTest {
|
||||
isIconLoadingDisabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
vaultFilterType = VaultFilterType.AllVaults,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -234,6 +238,7 @@ class VaultDataExtensionsTest {
|
||||
isIconLoadingDisabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
vaultFilterType = VaultFilterType.AllVaults,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -257,6 +262,7 @@ class VaultDataExtensionsTest {
|
||||
isIconLoadingDisabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
vaultFilterType = VaultFilterType.AllVaults,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -291,6 +297,7 @@ class VaultDataExtensionsTest {
|
||||
vaultFilterType = VaultFilterType.AllVaults,
|
||||
isIconLoadingDisabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -439,6 +446,7 @@ class VaultDataExtensionsTest {
|
||||
isIconLoadingDisabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
vaultFilterType = VaultFilterType.AllVaults,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -479,6 +487,7 @@ class VaultDataExtensionsTest {
|
||||
isIconLoadingDisabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
vaultFilterType = VaultFilterType.AllVaults,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
@@ -531,6 +540,7 @@ class VaultDataExtensionsTest {
|
||||
isIconLoadingDisabled = false,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
vaultFilterType = VaultFilterType.AllVaults,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
|
||||
Reference in New Issue
Block a user