mirror of
https://github.com/bitwarden/android.git
synced 2024-11-26 03:16:10 +03:00
BIT-1939: Add collection IDs back to network response (#1059)
This commit is contained in:
parent
206d25bb48
commit
0537ccde07
2 changed files with 13 additions and 6 deletions
|
@ -895,6 +895,7 @@ class VaultRepositoryImpl(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.map { it.copy(collectionIds = cipherView.collectionIds) }
|
||||||
.onSuccess {
|
.onSuccess {
|
||||||
// Save the send immediately, regardless of whether the decrypt succeeds
|
// Save the send immediately, regardless of whether the decrypt succeeds
|
||||||
vaultDiskSource.saveCipher(userId = userId, cipher = it)
|
vaultDiskSource.saveCipher(userId = userId, cipher = it)
|
||||||
|
|
|
@ -3382,7 +3382,10 @@ class VaultRepositoryTest {
|
||||||
val mockByteArray = byteArrayOf(1, 2)
|
val mockByteArray = byteArrayOf(1, 2)
|
||||||
val mockAttachmentEncryptResult = createMockAttachmentEncryptResult(number = 1)
|
val mockAttachmentEncryptResult = createMockAttachmentEncryptResult(number = 1)
|
||||||
val mockAttachmentJsonResponse = createMockAttachmentJsonResponse(number = 1)
|
val mockAttachmentJsonResponse = createMockAttachmentJsonResponse(number = 1)
|
||||||
val mockCipherResponse = createMockCipher(number = 1)
|
val mockCipherResponse = createMockCipher(number = 1).copy(collectionIds = null)
|
||||||
|
val mockUpdatedCipherResponse = createMockCipher(number = 1).copy(
|
||||||
|
collectionIds = listOf("mockId-1"),
|
||||||
|
)
|
||||||
coEvery {
|
coEvery {
|
||||||
vaultSdkSource.encryptCipher(userId = userId, cipherView = mockCipherView)
|
vaultSdkSource.encryptCipher(userId = userId, cipherView = mockCipherView)
|
||||||
} returns mockCipher.asSuccess()
|
} returns mockCipher.asSuccess()
|
||||||
|
@ -3412,12 +3415,12 @@ class VaultRepositoryTest {
|
||||||
)
|
)
|
||||||
} returns mockCipherResponse.asSuccess()
|
} returns mockCipherResponse.asSuccess()
|
||||||
coEvery {
|
coEvery {
|
||||||
vaultDiskSource.saveCipher(userId = userId, cipher = mockCipherResponse)
|
vaultDiskSource.saveCipher(userId = userId, cipher = mockUpdatedCipherResponse)
|
||||||
} just runs
|
} just runs
|
||||||
coEvery {
|
coEvery {
|
||||||
vaultSdkSource.decryptCipher(
|
vaultSdkSource.decryptCipher(
|
||||||
userId = userId,
|
userId = userId,
|
||||||
cipher = mockCipherResponse.toEncryptedSdkCipher(),
|
cipher = mockUpdatedCipherResponse.toEncryptedSdkCipher(),
|
||||||
)
|
)
|
||||||
} returns Throwable("Fail").asFailure()
|
} returns Throwable("Fail").asFailure()
|
||||||
|
|
||||||
|
@ -3453,7 +3456,10 @@ class VaultRepositoryTest {
|
||||||
val mockByteArray = byteArrayOf(1, 2)
|
val mockByteArray = byteArrayOf(1, 2)
|
||||||
val mockAttachmentEncryptResult = createMockAttachmentEncryptResult(number = 1)
|
val mockAttachmentEncryptResult = createMockAttachmentEncryptResult(number = 1)
|
||||||
val mockAttachmentJsonResponse = createMockAttachmentJsonResponse(number = 1)
|
val mockAttachmentJsonResponse = createMockAttachmentJsonResponse(number = 1)
|
||||||
val mockCipherResponse = createMockCipher(number = 1)
|
val mockCipherResponse = createMockCipher(number = 1).copy(collectionIds = null)
|
||||||
|
val mockUpdatedCipherResponse = createMockCipher(number = 1).copy(
|
||||||
|
collectionIds = listOf("mockId-1"),
|
||||||
|
)
|
||||||
coEvery {
|
coEvery {
|
||||||
vaultSdkSource.encryptCipher(userId = userId, cipherView = mockCipherView)
|
vaultSdkSource.encryptCipher(userId = userId, cipherView = mockCipherView)
|
||||||
} returns mockCipher.asSuccess()
|
} returns mockCipher.asSuccess()
|
||||||
|
@ -3483,12 +3489,12 @@ class VaultRepositoryTest {
|
||||||
)
|
)
|
||||||
} returns mockCipherResponse.asSuccess()
|
} returns mockCipherResponse.asSuccess()
|
||||||
coEvery {
|
coEvery {
|
||||||
vaultDiskSource.saveCipher(userId = userId, cipher = mockCipherResponse)
|
vaultDiskSource.saveCipher(userId = userId, cipher = mockUpdatedCipherResponse)
|
||||||
} just runs
|
} just runs
|
||||||
coEvery {
|
coEvery {
|
||||||
vaultSdkSource.decryptCipher(
|
vaultSdkSource.decryptCipher(
|
||||||
userId = userId,
|
userId = userId,
|
||||||
cipher = mockCipherResponse.toEncryptedSdkCipher(),
|
cipher = mockUpdatedCipherResponse.toEncryptedSdkCipher(),
|
||||||
)
|
)
|
||||||
} returns mockCipherView.asSuccess()
|
} returns mockCipherView.asSuccess()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue