commit f7629d9be5a3c7853127557ada2543fe251f387a
parent 6e6b303318ba906f8fd6f7f72c1a576e0994dae6
Author: Antoine A <>
Date: Thu, 10 Oct 2024 16:28:18 +0200
nexus: fix CLI test
Diffstat:
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/nexus/src/test/kotlin/CliTest.kt b/nexus/src/test/kotlin/CliTest.kt
@@ -64,10 +64,15 @@ class CliTest {
for (cmd in cmds) {
nexusCmd.testErr("$cmd -c $conf", "Missing client private keys file at '$clientKeysPath', run 'libeufin-nexus ebics-setup' first")
}
+ // Empty client file
+ clientKeysPath.createFile()
+ for (cmd in allCmds) {
+ nexusCmd.testErr("$cmd -c $conf", "Could not decode client private keys at '$clientKeysPath': Expected start of the object '{', but had 'EOF' instead at path: $\nJSON input: ")
+ }
// Bad client json
clientKeysPath.writeText("CORRUPTION", Charsets.UTF_8)
for (cmd in allCmds) {
- nexusCmd.testErr("$cmd -c $conf", "Could not decode client private keys at '$clientKeysPath': Expected start of the object '{', but had 'EOF' instead at path: $\nJSON input: CORRUPTION")
+ nexusCmd.testErr("$cmd -c $conf", "Could not decode client private keys at '$clientKeysPath': Unexpected JSON token at offset 0: Expected start of the object '{', but had 'C' instead at path: $\nJSON input: CORRUPTION")
}
// Missing permission
clientKeysPath.toFile().setReadable(false)
@@ -91,10 +96,15 @@ class CliTest {
for (cmd in cmds) {
nexusCmd.testErr("$cmd -c $conf", "Missing bank public keys at '$bankKeysPath', run 'libeufin-nexus ebics-setup' first")
}
+ // Empty bank file
+ bankKeysPath.createFile()
+ for (cmd in allCmds) {
+ nexusCmd.testErr("$cmd -c $conf", "Could not decode bank public keys at '$bankKeysPath': Expected start of the object '{', but had 'EOF' instead at path: $\nJSON input: ")
+ }
// Bad bank json
bankKeysPath.writeText("CORRUPTION", Charsets.UTF_8)
for (cmd in allCmds) {
- nexusCmd.testErr("$cmd -c $conf", "Could not decode bank public keys at '$bankKeysPath': Expected start of the object '{', but had 'EOF' instead at path: $\nJSON input: CORRUPTION")
+ nexusCmd.testErr("$cmd -c $conf", "Could not decode bank public keys at '$bankKeysPath': Unexpected JSON token at offset 0: Expected start of the object '{', but had 'C' instead at path: $\nJSON input: CORRUPTION")
}
// Missing permission
bankKeysPath.toFile().setReadable(false)