mirror of
https://github.com/bitwarden/android.git
synced 2025-03-15 18:58:59 +03:00
BIT-1935 Filter out trash items for export (#1048)
This commit is contained in:
parent
2fd3eac6ee
commit
8554a6653b
2 changed files with 18 additions and 2 deletions
|
@ -1231,7 +1231,7 @@ class VaultRepositoryImpl(
|
|||
.firstOrNull()
|
||||
.orEmpty()
|
||||
.map { it.toEncryptedSdkCipher() }
|
||||
.filter { it.collectionIds.isEmpty() }
|
||||
.filter { it.collectionIds.isEmpty() && it.deletedDate == null }
|
||||
|
||||
return vaultSdkSource
|
||||
.exportVaultDataToString(
|
||||
|
|
|
@ -5460,9 +5460,16 @@ class VaultRepositoryTest {
|
|||
fakeAuthDiskSource.userState = MOCK_USER_STATE
|
||||
val userId = "mockId-1"
|
||||
|
||||
val userCipher = createMockCipher(1).copy(
|
||||
collectionIds = null,
|
||||
deletedDate = null,
|
||||
)
|
||||
val deletedCipher = createMockCipher(2).copy(collectionIds = null)
|
||||
val orgCipher = createMockCipher(3).copy(deletedDate = null)
|
||||
|
||||
coEvery {
|
||||
vaultDiskSource.getCiphers(userId)
|
||||
} returns flowOf(listOf(createMockCipher(1)))
|
||||
} returns flowOf(listOf(userCipher, deletedCipher, orgCipher))
|
||||
|
||||
coEvery {
|
||||
vaultDiskSource.getFolders(userId)
|
||||
|
@ -5475,6 +5482,15 @@ class VaultRepositoryTest {
|
|||
val expected = ExportVaultDataResult.Success(vaultData = "TestResult")
|
||||
val result = vaultRepository.exportVaultDataToString(format = format)
|
||||
|
||||
coVerify {
|
||||
vaultSdkSource.exportVaultDataToString(
|
||||
userId = userId,
|
||||
ciphers = listOf(userCipher.toEncryptedSdkCipher()),
|
||||
folders = listOf(createMockSdkFolder(1)),
|
||||
format = ExportFormat.Json,
|
||||
)
|
||||
}
|
||||
|
||||
assertEquals(
|
||||
expected,
|
||||
result,
|
||||
|
|
Loading…
Add table
Reference in a new issue