commit 6fa3b924ac3eee6274ee5d5f0479f4da1bb76c57
parent dd2e4785206644403d5b8e1f5bb41bf71b917943
Author: Florian Dold <dold@taler.net>
Date: Tue, 8 Sep 2026 20:02:54 +0200
testbench: expect configuration exit status for EBICS key errors
Expect exit status 6 for missing, unreadable, malformed, or incomplete
EBICS keys, as introduced by the DD102 configuration error handling.
Keep expecting status 1 when writing key files fails.
Diffstat:
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/testbench/src/test/kotlin/CliTest.kt b/testbench/src/test/kotlin/CliTest.kt
@@ -34,7 +34,7 @@ import kotlin.test.assertEquals
val nexusCmd = LibeufinNexus()
val ebisyncCmd = LibeufinEbisync()
-fun CliktCommand.testErr(cmd: String, msg: String) {
+fun CliktCommand.testErr(cmd: String, msg: String, expectedStatusCode: Int = 1) {
val prevOut = System.err
val tmpOut = ByteArrayOutputStream()
System.setErr(PrintStream(tmpOut))
@@ -42,7 +42,7 @@ fun CliktCommand.testErr(cmd: String, msg: String) {
System.setErr(prevOut)
val tmpStr = tmpOut.asUtf8()
println(tmpStr)
- assertEquals(1, result.statusCode, "'$cmd' should have failed")
+ assertEquals(expectedStatusCode, result.statusCode, "'$cmd' should have failed")
val line = tmpStr.substringAfterLast(" - ").trimEnd('\n')
println(line)
assertEquals(msg, line)
@@ -67,18 +67,18 @@ class CliTest {
fun checkCmds(msg: String) {
for (cmd in listOf("ebics-submit", "ebics-fetch")) {
- nexusCmd.testErr("$cmd -c $conf", msg.replace("SETUPCMD", "libeufin-nexus ebics-setup"))
+ nexusCmd.testErr("$cmd -c $conf", msg.replace("SETUPCMD", "libeufin-nexus ebics-setup"), expectedStatusCode = 6)
}
for (cmd in listOf("fetch")) {
- ebisyncCmd.testErr("$cmd -c $conf", msg.replace("SETUPCMD", "libeufin-ebisync setup"))
+ ebisyncCmd.testErr("$cmd -c $conf", msg.replace("SETUPCMD", "libeufin-ebisync setup"), expectedStatusCode = 6)
}
}
fun checkAllCmds(msg: String) {
for (cmd in listOf("ebics-submit", "ebics-fetch", "ebics-setup")) {
- nexusCmd.testErr("$cmd -c $conf", msg)
+ nexusCmd.testErr("$cmd -c $conf", msg, expectedStatusCode = 6)
}
for (cmd in listOf("fetch", "setup")) {
- ebisyncCmd.testErr("$cmd -c $conf", msg)
+ ebisyncCmd.testErr("$cmd -c $conf", msg, expectedStatusCode = 6)
}
}
@@ -134,4 +134,4 @@ class CliTest {
ebisyncCmd.testErr("setup -c $conf", "Could not write client private keys at '$clientKeysPath': permission denied on '${clientKeysPath.parent}'")
}
}
-}
-\ No newline at end of file
+}