commit a1b00dd99136ca4387cbb63990a5fa3481498d1b
parent 5678ec87a3718c5a232372855280960be8504208
Author: MS <ms@taler.net>
Date: Mon, 13 Mar 2023 19:53:08 +0100
Testing.
Checking that debit threshold shows up
along the balance response offered by the
Access API.
Diffstat:
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/nexus/src/test/kotlin/SandboxAccessApiTest.kt b/nexus/src/test/kotlin/SandboxAccessApiTest.kt
@@ -210,6 +210,33 @@ class SandboxAccessApiTest {
}
}
+ // Checks that the debit threshold belongs to the balance response.
+ @Test
+ fun debitInfoCheck() {
+ withTestDatabase {
+ prepSandboxDb()
+ testApplication {
+ application(sandboxApp)
+ var r = client.get("/demobanks/default/access-api/accounts/foo") {
+ expectSuccess = true
+ basicAuth("foo", "foo")
+ }
+ // Checking that the response holds the debit threshold.
+ val mapper = ObjectMapper()
+ var respJson = mapper.readTree(r.bodyAsText())
+ var debitThreshold = respJson.get("debitThreshold").asText()
+ assert(debitThreshold == "1000")
+ r = client.get("/demobanks/default/access-api/accounts/admin") {
+ expectSuccess = true
+ basicAuth("admin", "foo")
+ }
+ respJson = mapper.readTree(r.bodyAsText())
+ debitThreshold = respJson.get("debitThreshold").asText()
+ assert(debitThreshold == "10000")
+ }
+ }
+ }
+
@Test
fun registerTest() {
// Test IBAN conflict detection.
diff --git a/nexus/src/test/kotlin/SandboxCircuitApiTest.kt b/nexus/src/test/kotlin/SandboxCircuitApiTest.kt
@@ -40,12 +40,12 @@ class SandboxCircuitApiTest {
prepSandboxDb()
testApplication {
application(sandboxApp)
- val R = client.get("/demobanks/default/circuit-api/accounts/bar") {
+ var R = client.get("/demobanks/default/circuit-api/accounts/bar") {
basicAuth("foo", "foo")
expectSuccess = false
}
assert(R.status.value == HttpStatusCode.Forbidden.value)
- client.get("/demobanks/default/circuit-api/accounts/bar") {
+ R = client.get("/demobanks/default/circuit-api/accounts/bar") {
basicAuth("admin", "foo")
expectSuccess = true
}