mirror of
https://github.com/bitwarden/android.git
synced 2026-11-19 17:40:12 -06:00
Add the setPassword API (#1110)
This commit is contained in:
committed by
Álison Fernandes
parent
f0a988c010
commit
932bc3957f
+24
@@ -9,6 +9,7 @@ import com.x8bit.bitwarden.data.auth.datasource.network.model.RegisterRequestJso
|
||||
import com.x8bit.bitwarden.data.auth.datasource.network.model.RegisterResponseJson
|
||||
import com.x8bit.bitwarden.data.auth.datasource.network.model.ResendEmailRequestJson
|
||||
import com.x8bit.bitwarden.data.auth.datasource.network.model.ResetPasswordRequestJson
|
||||
import com.x8bit.bitwarden.data.auth.datasource.network.model.SetPasswordRequestJson
|
||||
import com.x8bit.bitwarden.data.platform.base.BaseServiceTest
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import kotlinx.serialization.json.Json
|
||||
@@ -258,6 +259,29 @@ class AccountsServiceTest : BaseServiceTest() {
|
||||
assertTrue(result.isSuccess)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `setPassword with empty response is success`() = runTest {
|
||||
val response = MockResponse().setBody("")
|
||||
server.enqueue(response)
|
||||
val result = service.setPassword(
|
||||
body = SetPasswordRequestJson(
|
||||
passwordHash = "passwordHash",
|
||||
passwordHint = "passwordHint",
|
||||
organizationIdentifier = "organizationId",
|
||||
kdfIterations = 7,
|
||||
kdfMemory = 1,
|
||||
kdfParallelism = 2,
|
||||
kdfType = null,
|
||||
key = "encryptedUserKey",
|
||||
keys = RegisterRequestJson.Keys(
|
||||
publicKey = "public",
|
||||
encryptedPrivateKey = "private",
|
||||
),
|
||||
),
|
||||
)
|
||||
assertTrue(result.isSuccess)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val EMAIL = "email"
|
||||
private val registerRequestBody = RegisterRequestJson(
|
||||
|
||||
Reference in New Issue
Block a user