gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: Facade test.


From: gnunet
Subject: [libeufin] branch master updated: Facade test.
Date: Thu, 28 May 2020 18:10:27 +0200

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 8f5d1e8  Facade test.
8f5d1e8 is described below

commit 8f5d1e8d753b5c4120673d73919d61e9b6d54199
Author: MS <ms@taler.net>
AuthorDate: Thu May 28 18:10:10 2020 +0200

    Facade test.
    
    Get the facade creation to pass.
---
 integration-tests/test-taler-facade.py            | 26 ++++++++++++++++++++---
 nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt   |  7 +++---
 nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt |  8 +++----
 nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt |  2 +-
 4 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/integration-tests/test-taler-facade.py 
b/integration-tests/test-taler-facade.py
index ad7981c..6508cca 100755
--- a/integration-tests/test-taler-facade.py
+++ b/integration-tests/test-taler-facade.py
@@ -57,6 +57,7 @@ SUBSCRIBER_IBAN = "GB33BUKB20201555555555"
 SUBSCRIBER_BIC = "BUKBGB22"
 SUBSCRIBER_NAME = "Oliver Smith"
 BANK_ACCOUNT_LABEL = "savings"
+BANK_CONNECTION_LABEL = "my-ebics"
 
 # Databases
 NEXUS_DB="test-nexus.sqlite3"
@@ -187,7 +188,7 @@ assertResponse(
     post(
         "http://localhost:5001/bank-connections";,
         json=dict(
-            name="my-ebics",
+            name=BANK_CONNECTION_LABEL,
             source="new",
             type="ebics",
             data=dict(
@@ -202,7 +203,7 @@ print("connecting")
 
 assertResponse(
     post(
-        "http://localhost:5001/bank-connections/my-ebics/connect";,
+        
"http://localhost:5001/bank-connections/{}/connect".format(BANK_CONNECTION_LABEL),
         json=dict(),
         headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
     )
@@ -212,12 +213,31 @@ assertResponse(
 # 2.c, fetch bank account information
 assertResponse(
     post(
-        
"http://localhost:5001/bank-connections/my-ebics/ebics/import-accounts";,
+        
"http://localhost:5001/bank-connections/{}/ebics/import-accounts".format(BANK_CONNECTION_LABEL),
         json=dict(),
         headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
     )
 )
 
+# 3, create new facade
+assertResponse(
+    post(
+        "http://localhost:5001/facades";,
+        json=dict(
+            name="my-facade",
+            type="taler-wire-gateway",
+            creator=USERNAME,
+            config=dict(
+                bankAccount=BANK_ACCOUNT_LABEL,
+                bankConnection=BANK_CONNECTION_LABEL,
+                reserveTransferLevel="UNUSED",
+                intervalIncremental="UNUSED"
+            )
+        ),
+        headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
+    )
+)
+
 nexus.terminate()
 sandbox.terminate()
 print("Test passed!")
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index 0d45cd9..7979f73 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -272,8 +272,7 @@ class NexusBankConnectionEntity(id: EntityID<String>) : 
Entity<String>(id) {
 }
 
 object FacadesTable : IdTable<String>() {
-    override val id = 
NexusBankConnectionsTable.text("id").entityId().primaryKey()
-    val name = text("name")
+    override val id = FacadesTable.text("id").entityId().primaryKey()
     val type = text("type")
     val creator = reference("creator", NexusUsersTable)
     val config = reference("config", TalerFacadeConfigsTable) // see #6266
@@ -281,7 +280,6 @@ object FacadesTable : IdTable<String>() {
 
 class FacadeEntity(id: EntityID<String>) : Entity<String>(id) {
     companion object : EntityClass<String, FacadeEntity>(FacadesTable)
-    var name by FacadesTable.name
     var type by FacadesTable.type
     var creator by NexusUserEntity referencedOn FacadesTable.creator
     var config by TalerFacadeConfigEntity referencedOn FacadesTable.config
@@ -318,7 +316,8 @@ fun dbCreateTables(dbName: String) {
             TalerIncomingPayments,
             TalerRequestedPayments,
             NexusBankConnectionsTable,
-            NexusBankMessagesTable
+            NexusBankMessagesTable,
+            FacadesTable
         )
     }
 }
\ No newline at end of file
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt
index 8c7f399..1f57497 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt
@@ -257,10 +257,10 @@ data class FacadeInfo(
     val name: String,
     val type: String,
     val creator: String,
-    val bankAccountsRead: MutableList<String> = mutableListOf(),
-    val bankAccountsWrite: MutableList<String> = mutableListOf(),
-    val bankConnectionsRead: MutableList<String> = mutableListOf(),
-    val bankConnectionsWrite: MutableList<String> = mutableListOf(),
+    val bankAccountsRead: MutableList<String>? = mutableListOf(),
+    val bankAccountsWrite: MutableList<String>? = mutableListOf(),
+    val bankConnectionsRead: MutableList<String>? = mutableListOf(),
+    val bankConnectionsWrite: MutableList<String>? = mutableListOf(),
     val config: TalerWireGatewayFacadeConfig /* To be abstracted to Any! */
 )
 
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index b28e751..e2edd8b 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -947,8 +947,8 @@ fun serverMain(dbName: String) {
             }
             post("/facades") {
                 val body = call.receive<FacadeInfo>()
-                val user = authenticateRequest(call.request)
                 transaction {
+                    val user = authenticateRequest(call.request)
                     FacadeEntity.new(body.name) {
                         type = body.type
                         creator = user

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