gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: Scheduled tasks test case.


From: gnunet
Subject: [libeufin] branch master updated: Scheduled tasks test case.
Date: Fri, 17 Mar 2023 22:27:11 +0100

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

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 79b3ce63 Scheduled tasks test case.
79b3ce63 is described below

commit 79b3ce63052d8e5c87dd9abf78af780aff7c0707
Author: ms <ms@taler.net>
AuthorDate: Fri Mar 17 22:26:22 2023 +0100

    Scheduled tasks test case.
---
 .../tech/libeufin/nexus/server/NexusServer.kt      |  6 ++--
 nexus/src/test/kotlin/NexusApiTest.kt              | 38 ++++++++++++++++++++++
 2 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
index 12b0dd26..3a3c8733 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
@@ -738,9 +738,9 @@ val nexusApp: Application.() -> Unit = {
              */
             if (ingestionResult.errors != null)
             /**
-             * 500 is intentionally generic, because multiple errors
-             * may suggest different statuses.  The response body however
-             * informs the client about what failed.
+             * Nexus could not handle the error (regardless of it being 
generated
+             * here or gotten from the bank).  The response body should inform 
the
+             * client about what failed.
              */
             statusCode = HttpStatusCode.InternalServerError
             call.respond(
diff --git a/nexus/src/test/kotlin/NexusApiTest.kt 
b/nexus/src/test/kotlin/NexusApiTest.kt
new file mode 100644
index 00000000..4958e301
--- /dev/null
+++ b/nexus/src/test/kotlin/NexusApiTest.kt
@@ -0,0 +1,38 @@
+import io.ktor.client.plugins.*
+import io.ktor.client.request.*
+import io.ktor.http.*
+import io.ktor.server.testing.*
+import org.junit.Test
+import tech.libeufin.nexus.server.nexusApp
+
+/**
+ * This class tests the API offered by Nexus,
+ * documented here: https://docs.taler.net/libeufin/api-nexus.html
+ */
+class NexusApiTest {
+
+    // Testing the creation of scheduled tasks.
+    @Test
+    fun schedule() {
+        withTestDatabase {
+            prepNexusDb()
+            testApplication {
+                application(nexusApp)
+                // POSTing omitted 'params', to test whether Nexus
+                // expects it as 'null' for a 'submit' task.
+                client.post("/bank-accounts/foo/schedule") {
+                    contentType(ContentType.Application.Json)
+                    expectSuccess = true
+                    basicAuth("foo", "foo")
+                    // NOTE: current API doesn't allow to omit the 'params' 
field.
+                    setBody("""{
+                        "name": "send-payments",
+                        "cronspec": "* * *",
+                        "type": "submit",
+                        "params": null
+                    }""".trimIndent())
+                }
+            }
+        }
+    }
+}
\ No newline at end of file

-- 
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]