gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] 10/10: Test debit detection when serving EBICS.


From: gnunet
Subject: [libeufin] 10/10: Test debit detection when serving EBICS.
Date: Sat, 07 Jan 2023 13:49:09 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

commit 7dfef458b8e5feb726117b8b3105bb524c84b5e2
Author: MS <ms@taler.net>
AuthorDate: Sat Jan 7 13:43:38 2023 +0100

    Test debit detection when serving EBICS.
---
 nexus/src/test/kotlin/DownloadAndSubmit.kt | 25 +++++++++++++++++++++++++
 nexus/src/test/kotlin/MakeEnv.kt           | 12 ++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/nexus/src/test/kotlin/DownloadAndSubmit.kt 
b/nexus/src/test/kotlin/DownloadAndSubmit.kt
index 3d51dc45..0b8b5914 100644
--- a/nexus/src/test/kotlin/DownloadAndSubmit.kt
+++ b/nexus/src/test/kotlin/DownloadAndSubmit.kt
@@ -301,4 +301,29 @@ class DownloadAndSubmit {
             }
         }
     }
+
+    // Test the EBICS error message in case of debt threshold being surpassed
+    @Test
+    fun testDebit() {
+        withNexusAndSandboxUser {
+            testApplication {
+                application(sandboxApp)
+                runBlocking {
+                    // Create Pain.001 with excessive amount.
+                    addPaymentInitiation(
+                        Pain001Data(
+                            creditorIban = getIban(),
+                            creditorBic = "SANDBOXX",
+                            creditorName = "Tester",
+                            subject = "test payment",
+                            sum = "1000000",
+                            currency = "TESTKUDOS"
+                        ),
+                        "foo"
+                    )
+                    assertException<EbicsProtocolError> { 
submitAllPaymentInitiations(client, "foo") }
+                }
+            }
+        }
+    }
 }
\ No newline at end of file
diff --git a/nexus/src/test/kotlin/MakeEnv.kt b/nexus/src/test/kotlin/MakeEnv.kt
index a6e2ce2d..238b912c 100644
--- a/nexus/src/test/kotlin/MakeEnv.kt
+++ b/nexus/src/test/kotlin/MakeEnv.kt
@@ -31,6 +31,18 @@ val userKeys = EbicsKeys(
     enc = CryptoUtil.generateRsaKeyPair(2048),
     sig = CryptoUtil.generateRsaKeyPair(2048)
 )
+
+// New versions of JUnit provide this!
+inline fun <reified ExceptionType> assertException(block: () -> Unit) {
+    try {
+        block()
+    } catch (e: Throwable) {
+        assert(e.javaClass == ExceptionType::class.java)
+        return
+    }
+    return assert(false)
+}
+
 /**
  * Run a block after connecting to the test database.
  * Cleans up the DB file afterwards.

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]