summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMS <ms@taler.net>2023-09-29 12:23:53 +0200
committerMS <ms@taler.net>2023-09-29 12:23:53 +0200
commit7e6bed1a0cc09950198a84fe5977b8ed8f40091b (patch)
treecb0d308949a63feb886af7b9a2635db2c50b13d0
parent0a1c5a7465418dff7d63dbcc2dccd58ca0cea6ab (diff)
downloadlibeufin-7e6bed1a0cc09950198a84fe5977b8ed8f40091b.tar.gz
libeufin-7e6bed1a0cc09950198a84fe5977b8ed8f40091b.tar.bz2
libeufin-7e6bed1a0cc09950198a84fe5977b8ed8f40091b.zip
Testing token with forever duration.
-rw-r--r--bank/src/test/kotlin/LibeuFinApiTest.kt13
1 files changed, 13 insertions, 0 deletions
diff --git a/bank/src/test/kotlin/LibeuFinApiTest.kt b/bank/src/test/kotlin/LibeuFinApiTest.kt
index 18020481..a1d29720 100644
--- a/bank/src/test/kotlin/LibeuFinApiTest.kt
+++ b/bank/src/test/kotlin/LibeuFinApiTest.kt
@@ -3,6 +3,7 @@ import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.http.*
import io.ktor.server.testing.*
+import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import net.taler.wallet.crypto.Base32Crockford
import org.junit.Test
@@ -249,6 +250,18 @@ class LibeuFinApiTest {
setBody("{\"scope\": \"readonly\"}")
expectSuccess = true
}
+ // Testing the 'forever' case.
+ val forever = client.post("/accounts/foo/token") {
+ expectSuccess = true
+ contentType(ContentType.Application.Json)
+ basicAuth("foo", "pw")
+ setBody("""{
+ "scope": "readonly",
+ "duration": {"d_us": "forever"}
+ }""".trimIndent())
+ }
+ val never: TokenSuccessResponse = Json.decodeFromString(forever.bodyAsText())
+ assert(never.expiration.t_s == Instant.MAX)
}
}