commit 7008f055f66bbc459571334a38394b4404d351e5
parent 66fe30878986a6accc16712474c699a53e8705bb
Author: Antoine A <>
Date: Mon, 10 Jun 2024 14:34:26 +0200
cleaning
Diffstat:
11 files changed, 47 insertions(+), 47 deletions(-)
diff --git a/bank/src/test/kotlin/AmountTest.kt b/bank/src/test/kotlin/AmountTest.kt
@@ -321,7 +321,7 @@ class AmountTest {
}
@Test
- fun apiError() = bankSetup { _ ->
+ fun apiError() = bankSetup {
val base = obj {
"payto_uri" to "$exchangePayto?message=payout"
}
diff --git a/bank/src/test/kotlin/BankIntegrationApiTest.kt b/bank/src/test/kotlin/BankIntegrationApiTest.kt
@@ -30,7 +30,7 @@ import kotlin.test.assertEquals
class BankIntegrationApiTest {
// GET /taler-integration/config
@Test
- fun config() = bankSetup { _ ->
+ fun config() = bankSetup {
client.get("/taler-integration/config").assertOk()
}
@@ -81,7 +81,7 @@ class BankIntegrationApiTest {
// POST /taler-integration/withdrawal-operation/UUID
@Test
- fun select() = bankSetup { _ ->
+ fun select() = bankSetup {
val reserve_pub = EddsaPublicKey.rand()
val req = obj {
"reserve_pub" to reserve_pub
@@ -196,7 +196,7 @@ class BankIntegrationApiTest {
// POST /taler-integration/withdrawal-operation/UUID/abort
@Test
- fun abort() = bankSetup { _ ->
+ fun abort() = bankSetup {
// Check abort created
client.postA("/accounts/merchant/withdrawals") {
json { "amount" to "KUDOS:1" }
diff --git a/bank/src/test/kotlin/CommonApiTest.kt b/bank/src/test/kotlin/CommonApiTest.kt
@@ -24,7 +24,7 @@ import tech.libeufin.common.*
class CommonApiTest {
@Test
- fun commonErr() = bankSetup { _ ->
+ fun commonErr() = bankSetup {
client.get("/unknown").assertNotFound(TalerErrorCode.GENERIC_ENDPOINT_UNKNOWN)
client.post("/config").assertStatus(HttpStatusCode.MethodNotAllowed, TalerErrorCode.GENERIC_METHOD_INVALID)
}
diff --git a/bank/src/test/kotlin/ConversionApiTest.kt b/bank/src/test/kotlin/ConversionApiTest.kt
@@ -26,13 +26,13 @@ import kotlin.test.assertEquals
class ConversionApiTest {
// GET /conversion-info/config
@Test
- fun config() = bankSetup { _ ->
+ fun config() = bankSetup {
client.get("/conversion-info/config").assertOk()
}
// GET /conversion-info/cashout-rate
@Test
- fun cashoutRate() = bankSetup { _ ->
+ fun cashoutRate() = bankSetup {
// Check conversion to
client.get("/conversion-info/cashout-rate?amount_debit=KUDOS:1").assertOkJson<ConversionResponse> {
assertEquals(TalerAmount("KUDOS:1"), it.amount_debit)
@@ -67,7 +67,7 @@ class ConversionApiTest {
// GET /conversion-info/cashin-rate
@Test
- fun cashinRate() = bankSetup { _ ->
+ fun cashinRate() = bankSetup {
for ((amount, converted) in listOf(
Pair(0.75, 0.58), Pair(0.32, 0.24), Pair(0.66, 0.51)
)) {
@@ -117,7 +117,7 @@ class ConversionApiTest {
}
@Test
- fun notImplemented() = bankSetup("test_no_conversion.conf") { _ ->
+ fun notImplemented() = bankSetup("test_no_conversion.conf") {
client.get("/conversion-info/cashin-rate")
.assertNotImplemented()
client.get("/conversion-info/cashout-rate")
diff --git a/bank/src/test/kotlin/CoreBankApiTest.kt b/bank/src/test/kotlin/CoreBankApiTest.kt
@@ -35,13 +35,13 @@ import kotlin.test.assertNull
class CoreBankConfigTest {
// GET /config
@Test
- fun config() = bankSetup { _ ->
+ fun config() = bankSetup {
client.get("/config").assertOk()
}
// GET /monitor
@Test
- fun monitor() = bankSetup { _ ->
+ fun monitor() = bankSetup {
authRoutine(HttpMethod.Get, "/monitor", requireAdmin = true)
// Check OK
client.get("/monitor?timeframe=day&which=25") {
@@ -135,7 +135,7 @@ class CoreBankTokenApiTest {
// DELETE /accounts/USERNAME/token
@Test
- fun delete() = bankSetup { _ ->
+ fun delete() = bankSetup {
// TODO test restricted
val token = client.postA("/accounts/merchant/token") {
json { "scope" to "readonly" }
@@ -157,7 +157,7 @@ class CoreBankTokenApiTest {
class CoreBankAccountsApiTest {
// Testing the account creation and its idempotency
@Test
- fun create() = bankSetup { _ ->
+ fun create() = bankSetup {
// Check generated payto
obj {
"username" to "john"
@@ -375,7 +375,7 @@ class CoreBankAccountsApiTest {
// Test account created with bonus
@Test
- fun createBonus() = bankSetup(conf = "test_bonus.conf") { _ ->
+ fun createBonus() = bankSetup(conf = "test_bonus.conf") {
val req = obj {
"username" to "foo"
"password" to "xyz"
@@ -410,7 +410,7 @@ class CoreBankAccountsApiTest {
// Test admin-only account creation
@Test
- fun createRestricted() = bankSetup(conf = "test_restrict.conf") { _ ->
+ fun createRestricted() = bankSetup(conf = "test_restrict.conf") {
authRoutine(HttpMethod.Post, "/accounts", requireAdmin = true)
client.post("/accounts") {
pwAuth("admin")
@@ -424,7 +424,7 @@ class CoreBankAccountsApiTest {
// Test admin-only account creation
@Test
- fun createTanErr() = bankSetup(conf = "test_tan_err.conf") { _ ->
+ fun createTanErr() = bankSetup(conf = "test_tan_err.conf") {
client.post("/accounts") {
pwAuth("admin")
json {
@@ -545,7 +545,7 @@ class CoreBankAccountsApiTest {
// Test admin-only account deletion
@Test
- fun deleteRestricted() = bankSetup(conf = "test_restrict.conf") { _ ->
+ fun deleteRestricted() = bankSetup(conf = "test_restrict.conf") {
authRoutine(HttpMethod.Post, "/accounts", requireAdmin = true)
// Exchange is still restricted
client.delete("/accounts/exchange") {
@@ -555,7 +555,7 @@ class CoreBankAccountsApiTest {
// Test delete exchange account
@Test
- fun deleteNoConversion() = bankSetup(conf = "test_no_conversion.conf") { _ ->
+ fun deleteNoConversion() = bankSetup(conf = "test_no_conversion.conf") {
// Exchange is no longer restricted
client.deleteA("/accounts/exchange").assertNoContent()
}
@@ -581,7 +581,7 @@ class CoreBankAccountsApiTest {
// PATCH /accounts/USERNAME
@Test
- fun reconfig() = bankSetup { _ ->
+ fun reconfig() = bankSetup {
authRoutine(HttpMethod.Patch, "/accounts/merchant", allowAdmin = true)
// Check tan info
@@ -700,7 +700,7 @@ class CoreBankAccountsApiTest {
// Test admin-only account patch
@Test
- fun patchRestricted() = bankSetup(conf = "test_restrict.conf") { _ ->
+ fun patchRestricted() = bankSetup(conf = "test_restrict.conf") {
// Check restricted
checkAdminOnly(
obj { "name" to "Another Foo" },
@@ -724,7 +724,7 @@ class CoreBankAccountsApiTest {
// Test TAN check account patch
@Test
- fun patchTanErr() = bankSetup(conf = "test_tan_err.conf") { _ ->
+ fun patchTanErr() = bankSetup(conf = "test_tan_err.conf") {
// Check unsupported TAN channel
client.patchA("/accounts/customer") {
json {
@@ -735,7 +735,7 @@ class CoreBankAccountsApiTest {
// PATCH /accounts/USERNAME/auth
@Test
- fun passwordChange() = bankSetup { _ ->
+ fun passwordChange() = bankSetup {
authRoutine(HttpMethod.Patch, "/accounts/merchant/auth", allowAdmin = true)
// Changing the password.
@@ -872,7 +872,7 @@ class CoreBankAccountsApiTest {
// GET /accounts/USERNAME
@Test
- fun get() = bankSetup { _ ->
+ fun get() = bankSetup {
authRoutine(HttpMethod.Get, "/accounts/merchant", allowAdmin = true)
// Check ok
client.getA("/accounts/merchant").assertOkJson<AccountData> {
@@ -884,7 +884,7 @@ class CoreBankAccountsApiTest {
class CoreBankTransactionsApiTest {
// GET /transactions
@Test
- fun history() = bankSetup { _ ->
+ fun history() = bankSetup {
authRoutine(HttpMethod.Get, "/accounts/merchant/transactions", allowAdmin = true)
historyRoutine<BankAccountTransactionsResponse>(
url = "/accounts/customer/transactions",
@@ -922,7 +922,7 @@ class CoreBankTransactionsApiTest {
// GET /transactions/T_ID
@Test
- fun testById() = bankSetup { _ ->
+ fun testById() = bankSetup {
authRoutine(HttpMethod.Get, "/accounts/merchant/transactions/42", allowAdmin = true)
// Create transaction
@@ -1181,7 +1181,7 @@ class CoreBankTransactionsApiTest {
class CoreBankWithdrawalApiTest {
// POST /accounts/USERNAME/withdrawals
@Test
- fun create() = bankSetup { _ ->
+ fun create() = bankSetup {
authRoutine(HttpMethod.Post, "/accounts/merchant/withdrawals")
// Check OK
@@ -1226,7 +1226,7 @@ class CoreBankWithdrawalApiTest {
// GET /withdrawals/withdrawal_id
@Test
- fun get() = bankSetup { _ ->
+ fun get() = bankSetup {
val amount = TalerAmount("KUDOS:9.0")
// Check OK
client.postA("/accounts/merchant/withdrawals") {
@@ -1250,7 +1250,7 @@ class CoreBankWithdrawalApiTest {
// POST /accounts/USERNAME/withdrawals/withdrawal_id/confirm
@Test
- fun confirm() = bankSetup { _ ->
+ fun confirm() = bankSetup {
authRoutine(HttpMethod.Post, "/accounts/merchant/withdrawals/42/confirm")
// Check confirm created
client.postA("/accounts/merchant/withdrawals") {
@@ -1345,7 +1345,7 @@ class CoreBankWithdrawalApiTest {
class CoreBankCashoutApiTest {
// POST /accounts/{USERNAME}/cashouts
@Test
- fun create() = bankSetup { _ ->
+ fun create() = bankSetup {
authRoutine(HttpMethod.Post, "/accounts/merchant/cashouts")
val req = obj {
@@ -1460,7 +1460,7 @@ class CoreBankCashoutApiTest {
// GET /accounts/{USERNAME}/cashouts/{CASHOUT_ID}
@Test
- fun get() = bankSetup { _ ->
+ fun get() = bankSetup {
authRoutine(HttpMethod.Get, "/accounts/merchant/cashouts/42", allowAdmin = true)
fillCashoutInfo("customer")
@@ -1508,7 +1508,7 @@ class CoreBankCashoutApiTest {
// GET /accounts/{USERNAME}/cashouts
@Test
- fun history() = bankSetup { _ ->
+ fun history() = bankSetup {
authRoutine(HttpMethod.Get, "/accounts/merchant/cashouts", allowAdmin = true)
historyRoutine<Cashouts>(
url = "/accounts/customer/cashouts",
@@ -1520,7 +1520,7 @@ class CoreBankCashoutApiTest {
// GET /cashouts
@Test
- fun globalHistory() = bankSetup { _ ->
+ fun globalHistory() = bankSetup {
authRoutine(HttpMethod.Get, "/cashouts", requireAdmin = true)
historyRoutine<GlobalCashouts>(
url = "/cashouts",
@@ -1532,7 +1532,7 @@ class CoreBankCashoutApiTest {
}
@Test
- fun notImplemented() = bankSetup("test_no_conversion.conf") { _ ->
+ fun notImplemented() = bankSetup("test_no_conversion.conf") {
client.get("/accounts/customer/cashouts")
.assertNotImplemented()
}
@@ -1541,7 +1541,7 @@ class CoreBankCashoutApiTest {
class CoreBankTanApiTest {
// POST /accounts/{USERNAME}/challenge/{challenge_id}
@Test
- fun send() = bankSetup { _ ->
+ fun send() = bankSetup {
authRoutine(HttpMethod.Post, "/accounts/merchant/challenge/42")
suspend fun HttpResponse.expectChallenge(channel: TanChannel, info: String): HttpResponse {
@@ -1666,7 +1666,7 @@ class CoreBankTanApiTest {
// POST /accounts/{USERNAME}/challenge/{challenge_id}
@Test
- fun sendTanErr() = bankSetup("test_tan_err.conf") { _ ->
+ fun sendTanErr() = bankSetup("test_tan_err.conf") {
// Check fail
client.patch("/accounts/merchant") {
pwAuth("admin")
@@ -1685,7 +1685,7 @@ class CoreBankTanApiTest {
// POST /accounts/{USERNAME}/challenge/{challenge_id}/confirm
@Test
- fun confirm() = bankSetup { _ ->
+ fun confirm() = bankSetup {
authRoutine(HttpMethod.Post, "/accounts/merchant/challenge/42/confirm")
fillTanInfo("merchant")
diff --git a/bank/src/test/kotlin/PaytoTest.kt b/bank/src/test/kotlin/PaytoTest.kt
@@ -28,7 +28,7 @@ import kotlin.test.assertEquals
class PaytoTest {
// x-taler-bank
@Test
- fun xTalerBank() = bankSetup("test_x_taler_bank.conf") { _ ->
+ fun xTalerBank() = bankSetup("test_x_taler_bank.conf") {
// Check Ok
client.post("/accounts") {
json {
diff --git a/bank/src/test/kotlin/RevenueApiTest.kt b/bank/src/test/kotlin/RevenueApiTest.kt
@@ -24,7 +24,7 @@ import tech.libeufin.common.*
class RevenueApiTest {
// GET /accounts/{USERNAME}/taler-revenue/config
@Test
- fun config() = bankSetup { _ ->
+ fun config() = bankSetup {
authRoutine(HttpMethod.Get, "/accounts/merchant/taler-revenue/config")
client.getA("/accounts/merchant/taler-revenue/config").assertOk()
diff --git a/bank/src/test/kotlin/SecurityTest.kt b/bank/src/test/kotlin/SecurityTest.kt
@@ -32,7 +32,7 @@ inline fun <reified B> HttpRequestBuilder.jsonDeflate(b: B) {
class SecurityTest {
@Test
- fun bodySizeLimit() = bankSetup { _ ->
+ fun bodySizeLimit() = bankSetup {
val valid_req = obj {
"payto_uri" to "$exchangePayto?message=payout"
"amount" to "KUDOS:0.3"
diff --git a/bank/src/test/kotlin/WireGatewayApiTest.kt b/bank/src/test/kotlin/WireGatewayApiTest.kt
@@ -24,7 +24,7 @@ import tech.libeufin.common.*
class WireGatewayApiTest {
// GET /accounts/{USERNAME}/taler-wire-gateway/config
@Test
- fun config() = bankSetup { _ ->
+ fun config() = bankSetup {
authRoutine(HttpMethod.Get, "/accounts/merchant/taler-wire-gateway/config")
client.getA("/accounts/merchant/taler-wire-gateway/config").assertOk()
@@ -32,7 +32,7 @@ class WireGatewayApiTest {
// POST /accounts/{USERNAME}/taler-wire-gateway/transfer
@Test
- fun transfer() = bankSetup { _ ->
+ fun transfer() = bankSetup {
val valid_req = obj {
"request_uid" to HashCode.rand()
"amount" to "KUDOS:55"
@@ -190,7 +190,7 @@ class WireGatewayApiTest {
// POST /accounts/{USERNAME}/taler-wire-gateway/admin/add-incoming
@Test
- fun addIncoming() = bankSetup { _ ->
+ fun addIncoming() = bankSetup {
val valid_req = obj {
"amount" to "KUDOS:44"
"reserve_pub" to EddsaPublicKey.rand()
diff --git a/nexus/src/test/kotlin/WireGatewayApiTest.kt b/nexus/src/test/kotlin/WireGatewayApiTest.kt
@@ -29,7 +29,7 @@ import tech.libeufin.nexus.*
class WireGatewayApiTest {
// GET /taler-wire-gateway/config
@Test
- fun config() = serverSetup { _ ->
+ fun config() = serverSetup {
authRoutine(HttpMethod.Get, "/taler-wire-gateway/config")
client.getA("/taler-wire-gateway/config").assertOk()
@@ -37,7 +37,7 @@ class WireGatewayApiTest {
// POST /taler-wire-gateway/transfer
@Test
- fun transfer() = serverSetup { _ ->
+ fun transfer() = serverSetup {
val valid_req = obj {
"request_uid" to HashCode.rand()
"amount" to "CHF:55"
@@ -179,7 +179,7 @@ class WireGatewayApiTest {
// POST /taler-wire-gateway/admin/add-incoming
@Test
- fun addIncoming() = serverSetup { _ ->
+ fun addIncoming() = serverSetup {
val valid_req = obj {
"amount" to "CHF:44"
"reserve_pub" to EddsaPublicKey.rand()
@@ -226,7 +226,7 @@ class WireGatewayApiTest {
}
@Test
- fun noApi() = serverSetup("mini.conf") { _ ->
+ fun noApi() = serverSetup("mini.conf") {
client.get("/taler-wire-gateway/config").assertNotImplemented()
}
}
\ No newline at end of file
diff --git a/testbench/src/test/kotlin/IntegrationTest.kt b/testbench/src/test/kotlin/IntegrationTest.kt
@@ -106,7 +106,7 @@ class IntegrationTest {
bankCmd.run("serve $flags")
}
- setup("conf/mini.conf") { _ ->
+ setup("conf/mini.conf") {
// Check bank is running
client.get("http://0.0.0.0:8080/public-accounts").assertNoContent()
}