summaryrefslogtreecommitdiff
path: root/nexus/src/test/kotlin/NexusApiTest.kt
diff options
context:
space:
mode:
authorms <ms@taler.net>2023-03-17 22:26:22 +0100
committerms <ms@taler.net>2023-03-17 22:26:22 +0100
commit79b3ce63052d8e5c87dd9abf78af780aff7c0707 (patch)
tree8f0fc0366ac2fcf314dd61efc08019ba29c8a30e /nexus/src/test/kotlin/NexusApiTest.kt
parent973ec3de5e78fa670f76a0d57f32ca1a1bbe8122 (diff)
downloadlibeufin-79b3ce63052d8e5c87dd9abf78af780aff7c0707.tar.gz
libeufin-79b3ce63052d8e5c87dd9abf78af780aff7c0707.tar.bz2
libeufin-79b3ce63052d8e5c87dd9abf78af780aff7c0707.zip
Scheduled tasks test case.
Diffstat (limited to 'nexus/src/test/kotlin/NexusApiTest.kt')
-rw-r--r--nexus/src/test/kotlin/NexusApiTest.kt38
1 files changed, 38 insertions, 0 deletions
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