commit 66db2da95f1d2614d515708f8ef318bef1d263a5
parent 5dff0e0f91bf304b8a0fc86f365248b41343af2f
Author: Antoine A <>
Date: Mon, 27 Nov 2023 09:25:30 +0000
Fix tests
Diffstat:
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/Config.kt b/bank/src/main/kotlin/tech/libeufin/bank/Config.kt
@@ -119,11 +119,13 @@ fun TalerConfig.loadBankConfig(): BankConfig = catchError {
allowConversion = allowConversion,
fiatCurrency = fiatCurrency,
fiatCurrencySpec = fiatCurrencySpec,
- tanSms = lookupPath("libeufin-bank", "tan_sms"),
- tanEmail = lookupPath("libeufin-bank", "tan_email"),
+ tanSms = lookupPath("libeufin-bank", "tan_sms")?.notEmptyOrNull(),
+ tanEmail = lookupPath("libeufin-bank", "tan_email")?.notEmptyOrNull(),
)
}
+fun String.notEmptyOrNull(): String? = if (isEmpty()) null else this
+
fun TalerConfig.currencySpecificationFor(currency: String): CurrencySpecification = catchError {
sections.find {
it.startsWith("CURRENCY-") && requireBoolean(it, "enabled") && requireString(it, "code") == currency
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/helpers.kt b/bank/src/main/kotlin/tech/libeufin/bank/helpers.kt
@@ -40,7 +40,7 @@ import tech.libeufin.bank.AccountDAO.*
import tech.libeufin.util.*
private val logger: Logger = LoggerFactory.getLogger("tech.libeufin.bank.helpers")
-val reservedAccounts = setOf("admin", "bank")
+val reservedAccounts = setOf("admin", "bank") // exchange ?
fun ApplicationCall.expectUriComponent(componentName: String) =
maybeUriComponent(componentName) ?: throw badRequest(
diff --git a/bank/src/test/kotlin/CoreBankApiTest.kt b/bank/src/test/kotlin/CoreBankApiTest.kt
@@ -48,7 +48,7 @@ class CoreBankConfigTest {
fun monitor() = bankSetup { _ ->
authRoutine(HttpMethod.Get, "/monitor", requireAdmin = true)
// Check OK
- client.get("/monitor?timeframe=hour") {
+ client.get("/monitor?timeframe=day&wich=25") {
pwAuth("admin")
}.assertOk()
}
@@ -950,6 +950,8 @@ class CoreBankCashoutApiTest {
"amount_credit" to convert("KUDOS:1")
}
+ fillCashoutInfo("customer")
+
// Check unsupported TAN channel
client.postA("/accounts/customer/cashouts") {
json(req)