mirror of
https://github.com/bitwarden/android.git
synced 2026-11-19 17:40:12 -06:00
Add makeRegisterTdeKeysAndUnlockVault to authSdkSource (#1245)
This commit is contained in:
committed by
Álison Fernandes
parent
de39f76627
commit
92e39f25c1
@@ -4,6 +4,7 @@ import com.bitwarden.core.AuthRequestResponse
|
||||
import com.bitwarden.core.FingerprintRequest
|
||||
import com.bitwarden.core.MasterPasswordPolicyOptions
|
||||
import com.bitwarden.core.RegisterKeyResponse
|
||||
import com.bitwarden.core.RegisterTdeKeyResponse
|
||||
import com.bitwarden.crypto.HashPurpose
|
||||
import com.bitwarden.crypto.Kdf
|
||||
import com.bitwarden.sdk.Client
|
||||
@@ -157,6 +158,36 @@ class AuthSdkSourceTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `makeRegisterTdeKeysAndUnlockVault should call SDK and return a Result with the correct data`() =
|
||||
runBlocking {
|
||||
val userId = "userId"
|
||||
val orgPublicKey = "orgPublicKey"
|
||||
val rememberDevice = true
|
||||
val expectedResult = mockk<RegisterTdeKeyResponse>()
|
||||
coEvery { sdkClientManager.getOrCreateClient(userId = userId) } returns client
|
||||
coEvery {
|
||||
clientAuth.makeRegisterTdeKeys(
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = rememberDevice,
|
||||
)
|
||||
} returns expectedResult
|
||||
|
||||
val result = authSkdSource.makeRegisterTdeKeysAndUnlockVault(
|
||||
userId = userId,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = rememberDevice,
|
||||
)
|
||||
assertEquals(expectedResult.asSuccess(), result)
|
||||
coVerify(exactly = 1) {
|
||||
clientAuth.makeRegisterTdeKeys(
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = rememberDevice,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: This test is disabled due to issue here with mocking UByte (BIT-877).
|
||||
// See: https://github.com/mockk/mockk/issues/544
|
||||
@Disabled
|
||||
|
||||
Reference in New Issue
Block a user