mirror of
https://github.com/bitwarden/android.git
synced 2025-12-11 13:57:03 -06:00
[PM-25452] Dont show move to organization when user has no orgs (#5862)
This commit is contained in:
parent
a02a84ee08
commit
fec6479f6a
@ -371,9 +371,7 @@ fun VaultAddEditScreen(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.takeUnless {
|
.takeUnless { !state.shouldShowMoveToOrganization },
|
||||||
state.isAddItemMode || state.isCipherInCollection
|
|
||||||
},
|
|
||||||
OverflowMenuItemData(
|
OverflowMenuItemData(
|
||||||
text = stringResource(id = BitwardenString.collections),
|
text = stringResource(id = BitwardenString.collections),
|
||||||
onClick = remember(viewModel) {
|
onClick = remember(viewModel) {
|
||||||
|
|||||||
@ -2312,6 +2312,17 @@ data class VaultAddEditState(
|
|||||||
((viewState as? ViewState.Content)?.type is ViewState.Content.ItemType.Login) &&
|
((viewState as? ViewState.Content)?.type is ViewState.Content.ItemType.Login) &&
|
||||||
isAddItemMode
|
isAddItemMode
|
||||||
|
|
||||||
|
val hasOrganizations: Boolean
|
||||||
|
get() = (viewState as? ViewState.Content)
|
||||||
|
?.common
|
||||||
|
?.hasOrganizations
|
||||||
|
?: false
|
||||||
|
|
||||||
|
val shouldShowMoveToOrganization: Boolean
|
||||||
|
get() = !isAddItemMode &&
|
||||||
|
!isCipherInCollection &&
|
||||||
|
hasOrganizations
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum representing the main type options for the vault, such as LOGIN, CARD, etc.
|
* Enum representing the main type options for the vault, such as LOGIN, CARD, etc.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -194,7 +194,10 @@ fun VaultItemScreen(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.takeUnless { state.isCipherInCollection },
|
.takeUnless {
|
||||||
|
state.isCipherInCollection ||
|
||||||
|
!state.hasOrganizations
|
||||||
|
},
|
||||||
OverflowMenuItemData(
|
OverflowMenuItemData(
|
||||||
text = stringResource(id = BitwardenString.collections),
|
text = stringResource(id = BitwardenString.collections),
|
||||||
onClick = remember(viewModel) {
|
onClick = remember(viewModel) {
|
||||||
|
|||||||
@ -188,6 +188,9 @@ class VaultItemViewModel @Inject constructor(
|
|||||||
folderName?.let { VaultItemLocation.Folder(it) },
|
folderName?.let { VaultItemLocation.Folder(it) },
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val hasOrganizations =
|
||||||
|
!userState?.activeAccount?.organizations.isNullOrEmpty()
|
||||||
|
|
||||||
VaultItemStateData(
|
VaultItemStateData(
|
||||||
cipher = cipherView,
|
cipher = cipherView,
|
||||||
totpCodeItemData = totpCodeData,
|
totpCodeItemData = totpCodeData,
|
||||||
@ -196,6 +199,7 @@ class VaultItemViewModel @Inject constructor(
|
|||||||
canAssociateToCollections = canAssignToCollections,
|
canAssociateToCollections = canAssignToCollections,
|
||||||
canEdit = canEdit,
|
canEdit = canEdit,
|
||||||
relatedLocations = relatedLocations,
|
relatedLocations = relatedLocations,
|
||||||
|
hasOrganizations = hasOrganizations,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -1074,6 +1078,7 @@ class VaultItemViewModel @Inject constructor(
|
|||||||
baseIconUrl = environmentRepository.environment.environmentUrlData.baseIconUrl,
|
baseIconUrl = environmentRepository.environment.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = settingsRepository.isIconLoadingDisabled,
|
isIconLoadingDisabled = settingsRepository.isIconLoadingDisabled,
|
||||||
relatedLocations = this.data?.relatedLocations.orEmpty().toImmutableList(),
|
relatedLocations = this.data?.relatedLocations.orEmpty().toImmutableList(),
|
||||||
|
hasOrganizations = this.data?.hasOrganizations == true,
|
||||||
)
|
)
|
||||||
?: VaultItemState.ViewState.Error(message = errorText)
|
?: VaultItemState.ViewState.Error(message = errorText)
|
||||||
|
|
||||||
@ -1336,6 +1341,12 @@ data class VaultItemState(
|
|||||||
?.canAssignToCollections
|
?.canAssignToCollections
|
||||||
?: false
|
?: false
|
||||||
|
|
||||||
|
val hasOrganizations: Boolean
|
||||||
|
get() = viewState.asContentOrNull()
|
||||||
|
?.common
|
||||||
|
?.hasOrganizations
|
||||||
|
?: false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The text to display on the deletion confirmation dialog.
|
* The text to display on the deletion confirmation dialog.
|
||||||
*/
|
*/
|
||||||
@ -1392,6 +1403,7 @@ data class VaultItemState(
|
|||||||
* collections.
|
* collections.
|
||||||
* @property favorite Indicates that the cipher is favorite.
|
* @property favorite Indicates that the cipher is favorite.
|
||||||
* @property passwordHistoryCount An integer indicating how many times the password.
|
* @property passwordHistoryCount An integer indicating how many times the password.
|
||||||
|
* @property hasOrganizations Indicates if the user has organizations.
|
||||||
*/
|
*/
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data class Common(
|
data class Common(
|
||||||
@ -1412,6 +1424,7 @@ data class VaultItemState(
|
|||||||
val passwordHistoryCount: Int?,
|
val passwordHistoryCount: Int?,
|
||||||
val iconData: IconData,
|
val iconData: IconData,
|
||||||
val relatedLocations: ImmutableList<VaultItemLocation>,
|
val relatedLocations: ImmutableList<VaultItemLocation>,
|
||||||
|
val hasOrganizations: Boolean,
|
||||||
) : Parcelable {
|
) : Parcelable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import kotlinx.collections.immutable.ImmutableList
|
|||||||
* @property canAssociateToCollections Whether the item can be associated to a collection.
|
* @property canAssociateToCollections Whether the item can be associated to a collection.
|
||||||
* @property canEdit Whether the item can be edited.
|
* @property canEdit Whether the item can be edited.
|
||||||
* @property relatedLocations The locations the item is assigned to.
|
* @property relatedLocations The locations the item is assigned to.
|
||||||
|
* @property hasOrganizations Whether the user has organizations.
|
||||||
*/
|
*/
|
||||||
data class VaultItemStateData(
|
data class VaultItemStateData(
|
||||||
val cipher: CipherView?,
|
val cipher: CipherView?,
|
||||||
@ -21,4 +22,5 @@ data class VaultItemStateData(
|
|||||||
val canAssociateToCollections: Boolean,
|
val canAssociateToCollections: Boolean,
|
||||||
val canEdit: Boolean,
|
val canEdit: Boolean,
|
||||||
val relatedLocations: ImmutableList<VaultItemLocation>,
|
val relatedLocations: ImmutableList<VaultItemLocation>,
|
||||||
|
val hasOrganizations: Boolean,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -47,6 +47,7 @@ fun CipherView.toViewState(
|
|||||||
baseIconUrl: String,
|
baseIconUrl: String,
|
||||||
isIconLoadingDisabled: Boolean,
|
isIconLoadingDisabled: Boolean,
|
||||||
relatedLocations: ImmutableList<VaultItemLocation>,
|
relatedLocations: ImmutableList<VaultItemLocation>,
|
||||||
|
hasOrganizations: Boolean,
|
||||||
): VaultItemState.ViewState =
|
): VaultItemState.ViewState =
|
||||||
VaultItemState.ViewState.Content(
|
VaultItemState.ViewState.Content(
|
||||||
common = VaultItemState.ViewState.Content.Common(
|
common = VaultItemState.ViewState.Content.Common(
|
||||||
@ -113,6 +114,7 @@ fun CipherView.toViewState(
|
|||||||
isIconLoadingDisabled = isIconLoadingDisabled,
|
isIconLoadingDisabled = isIconLoadingDisabled,
|
||||||
),
|
),
|
||||||
relatedLocations = relatedLocations,
|
relatedLocations = relatedLocations,
|
||||||
|
hasOrganizations = hasOrganizations,
|
||||||
),
|
),
|
||||||
type = when (type) {
|
type = when (type) {
|
||||||
CipherType.LOGIN -> {
|
CipherType.LOGIN -> {
|
||||||
|
|||||||
@ -3601,6 +3601,7 @@ class VaultAddEditScreenTest : BitwardenComposeTest() {
|
|||||||
originalCipher = createMockCipherView(1).copy(
|
originalCipher = createMockCipherView(1).copy(
|
||||||
collectionIds = emptyList(),
|
collectionIds = emptyList(),
|
||||||
),
|
),
|
||||||
|
hasOrganizations = true,
|
||||||
),
|
),
|
||||||
type = VaultAddEditState.ViewState.Content.ItemType.SecureNotes,
|
type = VaultAddEditState.ViewState.Content.ItemType.SecureNotes,
|
||||||
isIndividualVaultDisabled = false,
|
isIndividualVaultDisabled = false,
|
||||||
@ -4258,6 +4259,75 @@ class VaultAddEditScreenTest : BitwardenComposeTest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `Move to organization option menu should not be visible if user has no organizations`() {
|
||||||
|
mutableStateFlow.update {
|
||||||
|
it.copy(
|
||||||
|
vaultAddEditType = VaultAddEditType.EditItem(vaultItemId = "mockId-1"),
|
||||||
|
viewState = VaultAddEditState.ViewState.Content(
|
||||||
|
common = VaultAddEditState.ViewState.Content.Common(
|
||||||
|
originalCipher = createMockCipherView(1).copy(
|
||||||
|
collectionIds = emptyList(),
|
||||||
|
),
|
||||||
|
hasOrganizations = false,
|
||||||
|
),
|
||||||
|
type = VaultAddEditState.ViewState.Content.ItemType.SecureNotes,
|
||||||
|
isIndividualVaultDisabled = false,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Confirm dropdown version of item is absent
|
||||||
|
composeTestRule
|
||||||
|
.onAllNodesWithText("Move to Organization")
|
||||||
|
.filter(hasAnyAncestor(isPopup()))
|
||||||
|
.assertCountEquals(0)
|
||||||
|
// Open the overflow menu
|
||||||
|
composeTestRule
|
||||||
|
.onNodeWithContentDescription("More")
|
||||||
|
.performClick()
|
||||||
|
|
||||||
|
// Confirm it does not exist
|
||||||
|
composeTestRule
|
||||||
|
.onAllNodesWithText("Move to Organization")
|
||||||
|
.filterToOne(hasAnyAncestor(isPopup()))
|
||||||
|
.assertIsNotDisplayed()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `Move to organization option menu should be visible if user has organizations`() {
|
||||||
|
mutableStateFlow.update {
|
||||||
|
it.copy(
|
||||||
|
vaultAddEditType = VaultAddEditType.EditItem(vaultItemId = "mockId-1"),
|
||||||
|
viewState = VaultAddEditState.ViewState.Content(
|
||||||
|
common = VaultAddEditState.ViewState.Content.Common(
|
||||||
|
originalCipher = createMockCipherView(1).copy(
|
||||||
|
collectionIds = emptyList(),
|
||||||
|
),
|
||||||
|
hasOrganizations = true,
|
||||||
|
),
|
||||||
|
type = VaultAddEditState.ViewState.Content.ItemType.SecureNotes,
|
||||||
|
isIndividualVaultDisabled = false,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Confirm dropdown version of item is absent
|
||||||
|
composeTestRule
|
||||||
|
.onAllNodesWithText("Move to Organization")
|
||||||
|
.filter(hasAnyAncestor(isPopup()))
|
||||||
|
.assertCountEquals(0)
|
||||||
|
|
||||||
|
composeTestRule
|
||||||
|
.onNodeWithContentDescription("More")
|
||||||
|
.performClick()
|
||||||
|
|
||||||
|
composeTestRule
|
||||||
|
.onAllNodesWithText("Move to Organization")
|
||||||
|
.filterToOne(hasAnyAncestor(isPopup()))
|
||||||
|
.assertIsDisplayed()
|
||||||
|
}
|
||||||
|
|
||||||
//endregion Helper functions
|
//endregion Helper functions
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@ -1352,6 +1352,12 @@ class VaultItemScreenTest : BitwardenComposeTest() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Move to organization option menu click should send MoveToOrganizationClick action`() {
|
fun `Move to organization option menu click should send MoveToOrganizationClick action`() {
|
||||||
|
mutableStateFlow.update {
|
||||||
|
DEFAULT_STATE.copy(
|
||||||
|
viewState = DEFAULT_LOGIN_VIEW_STATE,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Confirm dropdown version of item is absent
|
// Confirm dropdown version of item is absent
|
||||||
composeTestRule
|
composeTestRule
|
||||||
.onAllNodesWithText("Move to Organization")
|
.onAllNodesWithText("Move to Organization")
|
||||||
@ -1369,6 +1375,30 @@ class VaultItemScreenTest : BitwardenComposeTest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `Move to organization option menu should not be visible if user has no organizations`() {
|
||||||
|
mutableStateFlow.update {
|
||||||
|
DEFAULT_STATE.copy(
|
||||||
|
viewState = DEFAULT_LOGIN_VIEW_STATE.copy(
|
||||||
|
common = DEFAULT_COMMON.copy(hasOrganizations = false),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Confirm dropdown version of item is absent
|
||||||
|
composeTestRule
|
||||||
|
.onAllNodesWithText("Move to Organization")
|
||||||
|
.filter(hasAnyAncestor(isPopup()))
|
||||||
|
.assertCountEquals(0)
|
||||||
|
// Open the overflow menu
|
||||||
|
composeTestRule.onNodeWithContentDescription("More").performClick()
|
||||||
|
// Confirm it does not exist
|
||||||
|
composeTestRule
|
||||||
|
.onAllNodesWithText("Move to Organization")
|
||||||
|
.filterToOne(hasAnyAncestor(isPopup()))
|
||||||
|
.assertDoesNotExist()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `menu Collection option should be displayed based on state`() {
|
fun `menu Collection option should be displayed based on state`() {
|
||||||
mutableStateFlow.update {
|
mutableStateFlow.update {
|
||||||
@ -3195,6 +3225,7 @@ private val DEFAULT_COMMON: VaultItemState.ViewState.Content.Common =
|
|||||||
passwordHistoryCount = null,
|
passwordHistoryCount = null,
|
||||||
iconData = IconData.Local(iconRes = BitwardenDrawable.ic_globe),
|
iconData = IconData.Local(iconRes = BitwardenDrawable.ic_globe),
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
private val DEFAULT_PASSKEY = BitwardenString.created_x.asText("Mar 13, 2024, 3:56 PM")
|
private val DEFAULT_PASSKEY = BitwardenString.created_x.asText("Mar 13, 2024, 3:56 PM")
|
||||||
@ -3280,6 +3311,7 @@ private val EMPTY_COMMON: VaultItemState.ViewState.Content.Common =
|
|||||||
passwordHistoryCount = null,
|
passwordHistoryCount = null,
|
||||||
iconData = IconData.Local(iconRes = BitwardenDrawable.ic_globe),
|
iconData = IconData.Local(iconRes = BitwardenDrawable.ic_globe),
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
private val EMPTY_LOGIN_TYPE: VaultItemState.ViewState.Content.ItemType.Login =
|
private val EMPTY_LOGIN_TYPE: VaultItemState.ViewState.Content.ItemType.Login =
|
||||||
|
|||||||
@ -236,6 +236,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns DEFAULT_VIEW_STATE
|
} returns DEFAULT_VIEW_STATE
|
||||||
|
|
||||||
@ -278,6 +279,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns loginState
|
} returns loginState
|
||||||
|
|
||||||
@ -313,6 +315,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns DEFAULT_VIEW_STATE
|
} returns DEFAULT_VIEW_STATE
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -361,6 +364,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns DEFAULT_VIEW_STATE
|
} returns DEFAULT_VIEW_STATE
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -414,6 +418,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns loginViewState
|
} returns loginViewState
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -465,6 +470,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns viewState
|
} returns viewState
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -508,6 +514,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns DEFAULT_VIEW_STATE
|
} returns DEFAULT_VIEW_STATE
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -556,6 +563,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns DEFAULT_VIEW_STATE
|
} returns DEFAULT_VIEW_STATE
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -601,6 +609,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns loginViewState
|
} returns loginViewState
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -624,6 +633,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
assertEquals(
|
assertEquals(
|
||||||
@ -664,6 +674,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns createViewState()
|
} returns createViewState()
|
||||||
every { clipboardManager.setText(text = field) } just runs
|
every { clipboardManager.setText(text = field) } just runs
|
||||||
@ -688,6 +699,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
organizationEventManager.trackEvent(
|
organizationEventManager.trackEvent(
|
||||||
event = OrganizationEvent.CipherClientCopiedHiddenField(
|
event = OrganizationEvent.CipherClientCopiedHiddenField(
|
||||||
@ -741,6 +753,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns loginViewState
|
} returns loginViewState
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -778,6 +791,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
organizationEventManager.trackEvent(
|
organizationEventManager.trackEvent(
|
||||||
event = OrganizationEvent.CipherClientToggledHiddenFieldVisible(
|
event = OrganizationEvent.CipherClientToggledHiddenFieldVisible(
|
||||||
@ -802,6 +816,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns DEFAULT_VIEW_STATE
|
} returns DEFAULT_VIEW_STATE
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -840,6 +855,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns loginViewState
|
} returns loginViewState
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -873,6 +889,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -892,6 +909,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns DEFAULT_VIEW_STATE
|
} returns DEFAULT_VIEW_STATE
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -929,6 +947,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns DEFAULT_VIEW_STATE
|
} returns DEFAULT_VIEW_STATE
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -976,6 +995,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns loginViewState
|
} returns loginViewState
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1046,6 +1066,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns loginViewState
|
} returns loginViewState
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1218,6 +1239,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns DEFAULT_VIEW_STATE
|
} returns DEFAULT_VIEW_STATE
|
||||||
|
|
||||||
@ -1264,6 +1286,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns DEFAULT_VIEW_STATE
|
} returns DEFAULT_VIEW_STATE
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1313,6 +1336,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
coVerify(exactly = 1) {
|
coVerify(exactly = 1) {
|
||||||
@ -1334,6 +1358,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns createViewState()
|
} returns createViewState()
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1360,6 +1385,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1416,6 +1442,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns createViewState()
|
} returns createViewState()
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1442,6 +1469,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1484,6 +1512,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns createViewState()
|
} returns createViewState()
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1511,6 +1540,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1531,6 +1561,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns loginViewState
|
} returns loginViewState
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1567,6 +1598,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
organizationEventManager.trackEvent(
|
organizationEventManager.trackEvent(
|
||||||
event = OrganizationEvent.CipherClientToggledPasswordVisible(
|
event = OrganizationEvent.CipherClientToggledPasswordVisible(
|
||||||
@ -1604,6 +1636,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns createViewState(type = DEFAULT_CARD_TYPE)
|
} returns createViewState(type = DEFAULT_CARD_TYPE)
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1629,6 +1662,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1649,6 +1683,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns createViewState(type = DEFAULT_CARD_TYPE)
|
} returns createViewState(type = DEFAULT_CARD_TYPE)
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1677,6 +1712,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1695,6 +1731,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns createViewState(type = DEFAULT_CARD_TYPE)
|
} returns createViewState(type = DEFAULT_CARD_TYPE)
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1720,6 +1757,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1739,6 +1777,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns createViewState(type = DEFAULT_CARD_TYPE)
|
} returns createViewState(type = DEFAULT_CARD_TYPE)
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1767,6 +1806,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1799,6 +1839,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns SSH_KEY_VIEW_STATE
|
} returns SSH_KEY_VIEW_STATE
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1832,6 +1873,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns sshKeyViewState
|
} returns sshKeyViewState
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1865,6 +1907,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1883,6 +1926,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns createViewState(type = DEFAULT_SSH_KEY_TYPE)
|
} returns createViewState(type = DEFAULT_SSH_KEY_TYPE)
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1914,6 +1958,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns SSH_KEY_VIEW_STATE
|
} returns SSH_KEY_VIEW_STATE
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -1955,6 +2000,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns IDENTITY_VIEW_STATE
|
} returns IDENTITY_VIEW_STATE
|
||||||
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView)
|
||||||
@ -2114,6 +2160,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
VaultItemLocation.Collection("mockName-1"),
|
VaultItemLocation.Collection("mockName-1"),
|
||||||
VaultItemLocation.Folder("mockName-1"),
|
VaultItemLocation.Folder("mockName-1"),
|
||||||
),
|
),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns viewState
|
} returns viewState
|
||||||
mutableUserStateFlow.value = DEFAULT_USER_STATE.copy(
|
mutableUserStateFlow.value = DEFAULT_USER_STATE.copy(
|
||||||
@ -2176,6 +2223,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
VaultItemLocation.Collection("mockName-1"),
|
VaultItemLocation.Collection("mockName-1"),
|
||||||
VaultItemLocation.Folder("mockName-1"),
|
VaultItemLocation.Folder("mockName-1"),
|
||||||
),
|
),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns viewState
|
} returns viewState
|
||||||
mutableUserStateFlow.value = DEFAULT_USER_STATE.copy(
|
mutableUserStateFlow.value = DEFAULT_USER_STATE.copy(
|
||||||
@ -2237,6 +2285,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
VaultItemLocation.Collection("mockName-1"),
|
VaultItemLocation.Collection("mockName-1"),
|
||||||
VaultItemLocation.Folder("mockName-1"),
|
VaultItemLocation.Folder("mockName-1"),
|
||||||
),
|
),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns viewState
|
} returns viewState
|
||||||
mutableUserStateFlow.value = DEFAULT_USER_STATE.copy(
|
mutableUserStateFlow.value = DEFAULT_USER_STATE.copy(
|
||||||
@ -2306,6 +2355,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns viewState
|
} returns viewState
|
||||||
val viewModel = createViewModel(state = null)
|
val viewModel = createViewModel(state = null)
|
||||||
@ -2351,6 +2401,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns viewState
|
} returns viewState
|
||||||
val viewModel = createViewModel(state = null)
|
val viewModel = createViewModel(state = null)
|
||||||
@ -2391,6 +2442,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||||
isIconLoadingDisabled = false,
|
isIconLoadingDisabled = false,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} returns viewState
|
} returns viewState
|
||||||
val viewModel = createViewModel(state = null)
|
val viewModel = createViewModel(state = null)
|
||||||
@ -2511,7 +2563,17 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
isVaultUnlocked = true,
|
isVaultUnlocked = true,
|
||||||
needsPasswordReset = false,
|
needsPasswordReset = false,
|
||||||
isBiometricsEnabled = false,
|
isBiometricsEnabled = false,
|
||||||
organizations = emptyList(),
|
organizations = listOf(
|
||||||
|
Organization(
|
||||||
|
id = "organiationId",
|
||||||
|
name = "Test Organization",
|
||||||
|
shouldManageResetPassword = false,
|
||||||
|
shouldUseKeyConnector = false,
|
||||||
|
role = OrganizationType.USER,
|
||||||
|
keyConnectorUrl = null,
|
||||||
|
userIsClaimedByOrganization = false,
|
||||||
|
),
|
||||||
|
),
|
||||||
needsMasterPassword = false,
|
needsMasterPassword = false,
|
||||||
trustedDevice = null,
|
trustedDevice = null,
|
||||||
hasMasterPassword = true,
|
hasMasterPassword = true,
|
||||||
@ -2649,6 +2711,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||||||
passwordHistoryCount = 1,
|
passwordHistoryCount = 1,
|
||||||
iconData = IconData.Local(BitwardenDrawable.ic_globe),
|
iconData = IconData.Local(BitwardenDrawable.ic_globe),
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
private val DEFAULT_VIEW_STATE: VaultItemState.ViewState.Content =
|
private val DEFAULT_VIEW_STATE: VaultItemState.ViewState.Content =
|
||||||
|
|||||||
@ -57,6 +57,7 @@ class CipherViewExtensionsTest {
|
|||||||
baseIconUrl = "https://example.com/",
|
baseIconUrl = "https://example.com/",
|
||||||
isIconLoadingDisabled = true,
|
isIconLoadingDisabled = true,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
@ -90,6 +91,7 @@ class CipherViewExtensionsTest {
|
|||||||
baseIconUrl = "https://example.com/",
|
baseIconUrl = "https://example.com/",
|
||||||
isIconLoadingDisabled = true,
|
isIconLoadingDisabled = true,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
@ -129,6 +131,7 @@ class CipherViewExtensionsTest {
|
|||||||
baseIconUrl = "https://example.com/",
|
baseIconUrl = "https://example.com/",
|
||||||
isIconLoadingDisabled = true,
|
isIconLoadingDisabled = true,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
@ -159,6 +162,7 @@ class CipherViewExtensionsTest {
|
|||||||
baseIconUrl = "https://example.com/",
|
baseIconUrl = "https://example.com/",
|
||||||
isIconLoadingDisabled = true,
|
isIconLoadingDisabled = true,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
@ -187,6 +191,7 @@ class CipherViewExtensionsTest {
|
|||||||
baseIconUrl = "https://example.com/",
|
baseIconUrl = "https://example.com/",
|
||||||
isIconLoadingDisabled = true,
|
isIconLoadingDisabled = true,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
@ -218,6 +223,7 @@ class CipherViewExtensionsTest {
|
|||||||
baseIconUrl = "https://example.com/",
|
baseIconUrl = "https://example.com/",
|
||||||
isIconLoadingDisabled = true,
|
isIconLoadingDisabled = true,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
@ -259,6 +265,7 @@ class CipherViewExtensionsTest {
|
|||||||
baseIconUrl = "https://example.com/",
|
baseIconUrl = "https://example.com/",
|
||||||
isIconLoadingDisabled = true,
|
isIconLoadingDisabled = true,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
@ -305,6 +312,7 @@ class CipherViewExtensionsTest {
|
|||||||
baseIconUrl = "https://example.com/",
|
baseIconUrl = "https://example.com/",
|
||||||
isIconLoadingDisabled = true,
|
isIconLoadingDisabled = true,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
@ -353,6 +361,7 @@ class CipherViewExtensionsTest {
|
|||||||
baseIconUrl = "https://example.com/",
|
baseIconUrl = "https://example.com/",
|
||||||
isIconLoadingDisabled = true,
|
isIconLoadingDisabled = true,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
@ -385,6 +394,7 @@ class CipherViewExtensionsTest {
|
|||||||
baseIconUrl = "https://example.com/",
|
baseIconUrl = "https://example.com/",
|
||||||
isIconLoadingDisabled = true,
|
isIconLoadingDisabled = true,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val expectedState = VaultItemState.ViewState.Content(
|
val expectedState = VaultItemState.ViewState.Content(
|
||||||
@ -415,6 +425,7 @@ class CipherViewExtensionsTest {
|
|||||||
baseIconUrl = "https://example.com/",
|
baseIconUrl = "https://example.com/",
|
||||||
isIconLoadingDisabled = true,
|
isIconLoadingDisabled = true,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
VaultItemState.ViewState.Content(
|
VaultItemState.ViewState.Content(
|
||||||
@ -462,6 +473,7 @@ class CipherViewExtensionsTest {
|
|||||||
baseIconUrl = "https://example.com/",
|
baseIconUrl = "https://example.com/",
|
||||||
isIconLoadingDisabled = true,
|
isIconLoadingDisabled = true,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
it.value,
|
it.value,
|
||||||
@ -489,6 +501,7 @@ class CipherViewExtensionsTest {
|
|||||||
baseIconUrl = "https://example.com/",
|
baseIconUrl = "https://example.com/",
|
||||||
isIconLoadingDisabled = true,
|
isIconLoadingDisabled = true,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
IconData.Local(it.value),
|
IconData.Local(it.value),
|
||||||
|
|||||||
@ -185,6 +185,7 @@ fun createCommonContent(
|
|||||||
passwordHistoryCount = null,
|
passwordHistoryCount = null,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
iconData = IconData.Local(iconResId),
|
iconData = IconData.Local(iconResId),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
VaultItemState.ViewState.Content.Common(
|
VaultItemState.ViewState.Content.Common(
|
||||||
@ -248,6 +249,7 @@ fun createCommonContent(
|
|||||||
passwordHistoryCount = 1,
|
passwordHistoryCount = 1,
|
||||||
relatedLocations = persistentListOf(),
|
relatedLocations = persistentListOf(),
|
||||||
iconData = IconData.Local(iconResId),
|
iconData = IconData.Local(iconResId),
|
||||||
|
hasOrganizations = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user