commit 532b705fa31848c7118fefe9a10bbe0d32d9327f
parent 93590d0b4123f1983e2da4ae18bdf199db8f26a7
Author: MS <ms@taler.net>
Date: Thu, 5 Oct 2023 09:36:23 +0200
Testing account reconfig. idempotence.
Diffstat:
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/bank/src/test/kotlin/LibeuFinApiTest.kt b/bank/src/test/kotlin/LibeuFinApiTest.kt
@@ -722,28 +722,33 @@ class LibeuFinApiTest {
corebankWebApp(db, ctx)
}
assertNotNull(db.customerCreate(customerFoo))
- val validReq = json {
- "is_exchange" to true
- }
// First call expects 500, because foo lacks a bank account
client.patch("/accounts/foo") {
basicAuth("foo", "pw")
- jsonBody(validReq)
+ jsonBody(json {
+ "is_exchange" to true
+ })
}.assertStatus(HttpStatusCode.InternalServerError)
// Creating foo's bank account.
assertNotNull(db.bankAccountCreate(genBankAccount(1L)))
// Successful attempt now.
+ val validReq = AccountReconfiguration(
+ cashout_address = "payto://new-cashout-address",
+ challenge_contact_data = ChallengeContactData(
+ email = "new@example.com",
+ phone = "+987"
+ ),
+ is_exchange = true,
+ name = null
+ )
client.patch("/accounts/foo") {
basicAuth("foo", "pw")
- jsonBody(AccountReconfiguration(
- cashout_address = "payto://new-cashout-address",
- challenge_contact_data = ChallengeContactData(
- email = "new@example.com",
- phone = "+987"
- ),
- is_exchange = true,
- name = null
- ))
+ jsonBody(validReq)
+ }.assertStatus(HttpStatusCode.NoContent)
+ // Checking idempotence.
+ client.patch("/accounts/foo") {
+ basicAuth("foo", "pw")
+ jsonBody(validReq)
}.assertStatus(HttpStatusCode.NoContent)
// Checking ordinary user doesn't get to patch their name.
client.patch("/accounts/foo") {