mirror of
https://github.com/bitwarden/android.git
synced 2026-11-19 17:40:12 -06:00
Add ability to decrypt Collections (#373)
This commit is contained in:
committed by
Álison Fernandes
parent
79f1c2cd4c
commit
970e913373
@@ -3,6 +3,8 @@ package com.x8bit.bitwarden.data.vault.datasource.sdk
|
||||
import com.bitwarden.core.Cipher
|
||||
import com.bitwarden.core.CipherListView
|
||||
import com.bitwarden.core.CipherView
|
||||
import com.bitwarden.core.Collection
|
||||
import com.bitwarden.core.CollectionView
|
||||
import com.bitwarden.core.Folder
|
||||
import com.bitwarden.core.FolderView
|
||||
import com.bitwarden.core.InitUserCryptoRequest
|
||||
@@ -192,6 +194,53 @@ class VaultSdkSourceTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `decryptCollection should call SDK and return correct data wrapped in a Result`() =
|
||||
runBlocking {
|
||||
val mockCollection = mockk<Collection>()
|
||||
val expectedResult = mockk<CollectionView>()
|
||||
coEvery {
|
||||
clientVault.collections().decrypt(
|
||||
collection = mockCollection,
|
||||
)
|
||||
} returns expectedResult
|
||||
val result = vaultSdkSource.decryptCollection(
|
||||
collection = mockCollection,
|
||||
)
|
||||
assertEquals(
|
||||
expectedResult.asSuccess(), result,
|
||||
)
|
||||
coVerify {
|
||||
clientVault.collections().decrypt(
|
||||
collection = mockCollection,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `decryptCollectionList should call SDK and return correct data wrapped in a Result`() =
|
||||
runBlocking {
|
||||
val mockCollectionsList = mockk<List<Collection>>()
|
||||
val expectedResult = mockk<List<CollectionView>>()
|
||||
coEvery {
|
||||
clientVault.collections().decryptList(
|
||||
collections = mockCollectionsList,
|
||||
)
|
||||
} returns expectedResult
|
||||
val result = vaultSdkSource.decryptCollectionList(
|
||||
collectionList = mockCollectionsList,
|
||||
)
|
||||
assertEquals(
|
||||
expectedResult.asSuccess(),
|
||||
result,
|
||||
)
|
||||
coVerify {
|
||||
clientVault.collections().decryptList(
|
||||
collections = mockCollectionsList,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `decryptSendList should call SDK and return correct data wrapped in a Result`() =
|
||||
runBlocking {
|
||||
|
||||
Reference in New Issue
Block a user