[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.
- [libeufin] branch master updated (5ba09a22 -> 7dfef458), gnunet, 2023/01/07
- [libeufin] 02/10: comment, gnunet, 2023/01/07
- [libeufin] 04/10: Nexus DB helper to get bank accounts., gnunet, 2023/01/07
- [libeufin] 10/10: Test debit detection when serving EBICS.,
gnunet <=
- [libeufin] 09/10: fix loglevel, gnunet, 2023/01/07
- [libeufin] 08/10: Debit check at server side EBICS., gnunet, 2023/01/07
- [libeufin] 05/10: Nexus HTTP status codes review., gnunet, 2023/01/07
- [libeufin] 01/10: readme, gnunet, 2023/01/07
- [libeufin] 03/10: Fix accidental import., gnunet, 2023/01/07
- [libeufin] 07/10: Introduce debit check helper., gnunet, 2023/01/07
- [libeufin] 06/10: Nexus HTTP status codes review., gnunet, 2023/01/07