gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: Integration test.


From: gnunet
Subject: [libeufin] branch master updated: Integration test.
Date: Thu, 14 May 2020 18:25:10 +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 84f63ad  Integration test.
84f63ad is described below

commit 84f63adc02b66873a228e8432ace448a23509760
Author: MS <address@hidden>
AuthorDate: Thu May 14 18:24:32 2020 +0200

    Integration test.
    
    Fixing a out-of-transaction block statement,
    plus adapting the test itself to the new API.
---
 integration-tests/test-ebics-new.py                | 26 ++++++++++++++--------
 .../src/main/kotlin/tech/libeufin/nexus/Helpers.kt | 14 +++++-------
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/integration-tests/test-ebics-new.py 
b/integration-tests/test-ebics-new.py
index 9f4047c..0eb440b 100755
--- a/integration-tests/test-ebics-new.py
+++ b/integration-tests/test-ebics-new.py
@@ -199,25 +199,33 @@ assertResponse(
     )
 )
 
-nexus.terminate()
-sandbox.terminate()
-exit(44)
-
-#2.a
+#2.a, upload keys to the bank (INI & HIA)
 assertResponse(
     post(
-        "http://localhost:5001/ebics/subscribers/{}/sendINI".format(USERNAME),
-        json=dict()
+        "http://localhost:5001/bank-transports/sendINI";,
+        json=dict(
+          type="ebics",
+          name="my-ebics"
+        ),
+        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
     )
 )
 
 assertResponse(
     post(
-        "http://localhost:5001/ebics/subscribers/{}/sendHIA".format(USERNAME),
-        json=dict()
+        "http://localhost:5001/bank-transports/sendHIA";,
+        json=dict(
+          type="ebics",
+          name="my-ebics"
+        ),
+        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
     )
 )
 
+nexus.terminate()
+sandbox.terminate()
+exit(44)
+
 #2.b
 assertResponse(
     post(
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
index 135d53b..5523af1 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
@@ -139,20 +139,18 @@ fun getEbicsSubscriberDetailsInternal(subscriber: 
EbicsSubscriberEntity): EbicsC
 fun getEbicsTransport(userId: String, transportId: String? = null): 
EbicsSubscriberEntity {
     val transport = transaction {
         if (transportId == null) {
-            return@transaction EbicsSubscriberEntity.all().first()
+            return@transaction EbicsSubscriberEntity.find {
+                EbicsSubscribersTable.nexusUser eq userId
+            }.firstOrNull()
         }
-        return@transaction EbicsSubscriberEntity.findById(transportId)
+        return@transaction EbicsSubscriberEntity.find{
+            EbicsSubscribersTable.id eq transportId and 
(EbicsSubscribersTable.nexusUser eq userId)
+        }.firstOrNull()
     }
         ?: throw NexusError(
             HttpStatusCode.NotFound,
             "Could not find ANY Ebics transport for user $userId"
         )
-    if (transport.nexusUser.id.value != userId) {
-        throw NexusError(
-            HttpStatusCode.Forbidden,
-            "No rights over transport $transportId"
-        )
-    }
     return transport
 }
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]