gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: rename file


From: gnunet
Subject: [libeufin] branch master updated: rename file
Date: Fri, 15 May 2020 17:08:43 +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 4f0af79  rename file
4f0af79 is described below

commit 4f0af79c3cde2b71f8a3607d5310aaf375d011eb
Author: MS <address@hidden>
AuthorDate: Fri May 15 17:08:40 2020 +0200

    rename file
---
 integration-tests/test-ebics-new.py | 316 ------------------------------------
 integration-tests/test-ebics.py     | 158 ++++++++++++------
 2 files changed, 108 insertions(+), 366 deletions(-)

diff --git a/integration-tests/test-ebics-new.py 
b/integration-tests/test-ebics-new.py
deleted file mode 100755
index cc960cc..0000000
--- a/integration-tests/test-ebics-new.py
+++ /dev/null
@@ -1,316 +0,0 @@
-#!/usr/bin/env python3
-
-from requests import post, get
-from subprocess import call, Popen, PIPE
-from time import sleep
-import os
-import socket
-import sqlite3
-import hashlib
-import base64
-
-# Steps implemented in this test.
-#
-# 0 Prepare sandbox.
-#  -> (a) Make a EBICS host, (b) make a EBICS subscriber
-#     for the test runner, and (c) assign a IBAN to such
-#     subscriber.
-#
-# 1 Prepare nexus.
-#  -> (a) Make a Nexus user, (b) make a EBICS subscriber
-#     associated to that user
-#
-# 2 Prepare the Ebics transport for the nexus user.
-#  -> (a) Upload keys from Nexus to the Bank (INI & HIA),
-#     (b) Download key from the Bank (HPB) to the Nexus,
-#     and (c) Fetch the bank account owned by that subscriber
-#     at the bank.
-
-# 3 Request history from the Nexus to the Bank (C53).
-# 4 Verify that history is empty.
-# 5 Issue a payment from Nexus
-#  -> (a) Prepare & (b) trigger CCT.
-# 6 Request history after submitting the payment,
-#   from Nexus to Bank.
-# 7 Verify that previous payment shows up.
-
-# Nexus user details
-USERNAME="person"
-PASSWORD="y"
-USER_AUTHORIZATION_HEADER = "basic 
{}".format(base64.b64encode(b"person:y").decode("utf-8"))
-
-# Admin authentication
-ADMIN_AUTHORIZATION_HEADER = "basic 
{}".format(base64.b64encode(b"admin:x").decode("utf-8"))
-
-# EBICS details
-EBICS_URL="http://localhost:5000/ebicsweb";
-HOST_ID="HOST01"
-PARTNER_ID="PARTNER1"
-USER_ID="USER1"
-EBICS_VERSION = "H004"
-
-# Subscriber's bank account
-SUBSCRIBER_IBAN="GB33BUKB20201555555555"
-SUBSCRIBER_BIC="BUKBGB22"
-SUBSCRIBER_NAME="Oliver Smith"
-BANK_ACCOUNT_LABEL="savings"
-
-def checkPorts(ports):
-    for i in ports:
-        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        try:
-            s.bind(("0.0.0.0", i))
-            s.close()
-        except:
-            print("Port {} is not available".format(i))
-            exit(77)
-
-def assertResponse(response):
-    if response.status_code != 200:
-        print("Test failed on URL: {}".format(response.url))
-        # stdout/stderr from both services is A LOT of text.
-        # Confusing to dump all that to console.
-        print("Check nexus.log and sandbox.log, probably under /tmp")
-        nexus.terminate()
-        sandbox.terminate()
-        exit(1)
-    # Allows for finer grained checks.
-    return response
-
-#-1 Clean databases and start services.
-os.chdir("..")
-assert(0 == call(["rm", "-f", "sandbox/libeufin-sandbox.sqlite3"]))
-assert(0 == call(["rm", "-f", "nexus/libeufin-nexus.sqlite3"]))
-DEVNULL = open(os.devnull, "w")
-
-# Start nexus
-checkPorts([5001])
-nexus = Popen(["./gradlew", "nexus:run"], stdout=PIPE, stderr=PIPE)
-for i in range(10):
-    try:
-      get("http://localhost:5001/";)
-    except:
-        if i == 9:
-            nexus.terminate()
-            stdout, stderr = nexus.communicate()
-            print("Nexus timed out")
-            print("{}\n{}".format(stdout.decode(), stderr.decode()))
-            exit(77)
-        sleep(2)
-        continue
-    break
-# Start sandbox
-checkPorts([5000])
-sandbox = Popen(["./gradlew", "sandbox:run"], stdout=PIPE, stderr=PIPE)
-for i in range(10):
-    try:
-      get("http://localhost:5000/";)
-    except:
-        if i == 9:
-            nexus.terminate()
-            sandbox.terminate()
-            stdout, stderr = nexus.communicate()
-            print("Sandbox timed out")
-            print("{}\n{}".format(stdout.decode(), stderr.decode()))
-            exit(77)
-        sleep(2)
-        continue
-    break
-
-#0.a
-assertResponse(
-    post(
-        "http://localhost:5000/admin/ebics-host";,
-        json=dict(
-            hostID=HOST_ID,
-        ebicsVersion=EBICS_VERSION
-        )
-    )
-)
-
-#0.b
-assertResponse(
-    post(
-        "http://localhost:5000/admin/ebics-subscriber";,
-        json=dict(
-            hostID=HOST_ID,
-        partnerID=PARTNER_ID,
-        userID=USER_ID
-        )
-    )
-)
-
-#0.c
-assertResponse(
-    post(
-        "http://localhost:5000/admin/ebics-subscriber/bank-account";,
-        json=dict(
-            subscriber=dict(
-                hostID=HOST_ID,
-                partnerID=PARTNER_ID,
-                userID=USER_ID
-        ),
-            iban=SUBSCRIBER_IBAN,
-            bic=SUBSCRIBER_BIC,
-            name=SUBSCRIBER_NAME,
-        label=BANK_ACCOUNT_LABEL
-        )
-    )
-)
-
-#1.a, make a new nexus user.
-
-# "Create" the admin user first.
-dbconn = sqlite3.connect("nexus/libeufin-nexus.sqlite3")
-dbconn.execute(
-    "INSERT INTO NexusUsers (id, password) VALUES (?, ?)",
-    ("admin", sqlite3.Binary(hashlib.sha256(b"x").digest()))
-)
-dbconn.commit()
-dbconn.close()
-
-assertResponse(
-    post(
-        "http://localhost:5001/users";,
-        headers=dict(Authorization=ADMIN_AUTHORIZATION_HEADER),
-        json=dict(
-        username=USERNAME,
-        password=PASSWORD
-        )
-    )
-)
-
-#1.b, make a ebics transport for the new user.
-assertResponse(
-    post(
-        "http://localhost:5001/bank-transports";,
-        json=dict(
-            transport=dict(
-                name="my-ebics",
-                type="ebics"
-            ),
-            data=dict(
-                ebicsURL=EBICS_URL,
-                hostID=HOST_ID,
-                partnerID=PARTNER_ID,
-                userID=USER_ID
-            )
-        ),
-        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
-    )
-)
-
-#2.a, upload keys to the bank (INI & HIA)
-assertResponse(
-    post(
-        "http://localhost:5001/bank-transports/sendINI";,
-        json=dict(
-          type="ebics",
-          name="my-ebics"
-        ),
-        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
-    )
-)
-
-assertResponse(
-    post(
-        "http://localhost:5001/bank-transports/sendHIA";,
-        json=dict(
-          type="ebics",
-          name="my-ebics"
-        ),
-        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
-    )
-)
-
-#2.b, download keys from the bank (HPB)
-assertResponse(
-    post(
-        "http://localhost:5001/bank-transports/syncHPB";,
-        json=dict(
-          type="ebics",
-          name="my-ebics"
-        ),
-        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
-    )
-)
-
-#2.c, fetch bank account information
-assertResponse(
-    post(
-        "http://localhost:5001/bank-transports/syncHTD";,
-        json=dict(
-          type="ebics",
-          name="my-ebics"
-        ),
-        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
-    )
-)
-
-#3, ask nexus to download history
-assertResponse(
-    post(
-        "http://localhost:5001/bank-accounts/collected-transactions";,
-        json=dict(
-          type="ebics",
-          name="my-ebics"
-        ),
-        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
-    )
-)
-
-#4, make sure history is empty
-resp = assertResponse(
-    get(
-        
"http://localhost:5001/bank-accounts/{}/collected-transactions".format(BANK_ACCOUNT_LABEL),
-        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
-    )
-)
-assert(len(resp.json().get("transactions")) == 0)
-
-#5.a, prepare a payment
-resp = assertResponse(
-    post(
-        
"http://localhost:5001/bank-accounts/{}/prepared-payments".format(BANK_ACCOUNT_LABEL),
-        json=dict(
-            iban="FR7630006000011234567890189",
-            bic="AGRIFRPP",
-            name="Jacques La Fayette",
-            subject="integration test",
-            amount="EUR:1"
-        ),
-        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
-    )
-)
-PREPARED_PAYMENT_UUID=resp.json().get("uuid")
-assert(PREPARED_PAYMENT_UUID != None)
-
-#5.b, submit prepared statement
-assertResponse(
-    post(
-        "http://localhost:5001/bank-accounts/prepared-payments/submit";,
-        json=dict(uuid=PREPARED_PAYMENT_UUID),
-        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
-    )
-)
-
-#6, request history after payment submission
-assertResponse(
-    post(
-        "http://localhost:5001/bank-accounts/collected-transactions";,
-        json=dict(),
-        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
-    )
-)
-
-resp = assertResponse(
-    get(
-        
"http://localhost:5001/bank-accounts/{}/collected-transactions".format(BANK_ACCOUNT_LABEL),
-        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
-    )
-)
-assert(len(resp.json().get("transactions")) == 1)
-
-nexus.terminate()
-sandbox.terminate()
-print("Test passed!")
diff --git a/integration-tests/test-ebics.py b/integration-tests/test-ebics.py
index c1b02a8..cc960cc 100755
--- a/integration-tests/test-ebics.py
+++ b/integration-tests/test-ebics.py
@@ -5,6 +5,9 @@ from subprocess import call, Popen, PIPE
 from time import sleep
 import os
 import socket
+import sqlite3
+import hashlib
+import base64
 
 # Steps implemented in this test.
 #
@@ -27,11 +30,17 @@ import socket
 # 4 Verify that history is empty.
 # 5 Issue a payment from Nexus
 #  -> (a) Prepare & (b) trigger CCT.
-# 6 Request history again, from Nexus to Bank.
+# 6 Request history after submitting the payment,
+#   from Nexus to Bank.
 # 7 Verify that previous payment shows up.
 
 # Nexus user details
 USERNAME="person"
+PASSWORD="y"
+USER_AUTHORIZATION_HEADER = "basic 
{}".format(base64.b64encode(b"person:y").decode("utf-8"))
+
+# Admin authentication
+ADMIN_AUTHORIZATION_HEADER = "basic 
{}".format(base64.b64encode(b"admin:x").decode("utf-8"))
 
 # EBICS details
 EBICS_URL="http://localhost:5000/ebicsweb";
@@ -84,12 +93,13 @@ for i in range(10):
         if i == 9:
             nexus.terminate()
             stdout, stderr = nexus.communicate()
+            print("Nexus timed out")
             print("{}\n{}".format(stdout.decode(), stderr.decode()))
             exit(77)
-        sleep(1)
+        sleep(2)
         continue
     break
-
+# Start sandbox
 checkPorts([5000])
 sandbox = Popen(["./gradlew", "sandbox:run"], stdout=PIPE, stderr=PIPE)
 for i in range(10):
@@ -100,9 +110,10 @@ for i in range(10):
             nexus.terminate()
             sandbox.terminate()
             stdout, stderr = nexus.communicate()
+            print("Sandbox timed out")
             print("{}\n{}".format(stdout.decode(), stderr.decode()))
             exit(77)
-        sleep(1)
+        sleep(2)
         continue
     break
 
@@ -147,111 +158,158 @@ assertResponse(
     )
 )
 
-#1.a
+#1.a, make a new nexus user.
+
+# "Create" the admin user first.
+dbconn = sqlite3.connect("nexus/libeufin-nexus.sqlite3")
+dbconn.execute(
+    "INSERT INTO NexusUsers (id, password) VALUES (?, ?)",
+    ("admin", sqlite3.Binary(hashlib.sha256(b"x").digest()))
+)
+dbconn.commit()
+dbconn.close()
+
 assertResponse(
     post(
-        "http://localhost:5001/users/{}".format(USERNAME),
+        "http://localhost:5001/users";,
+        headers=dict(Authorization=ADMIN_AUTHORIZATION_HEADER),
         json=dict(
-        password="secret"
+        username=USERNAME,
+        password=PASSWORD
         )
     )
 )
 
-#1.b
+#1.b, make a ebics transport for the new user.
 assertResponse(
     post(
-        "http://localhost:5001/ebics/subscribers/{}".format(USERNAME),
+        "http://localhost:5001/bank-transports";,
         json=dict(
-        ebicsURL=EBICS_URL,
-        hostID=HOST_ID,
-        partnerID=PARTNER_ID,
-        userID=USER_ID
-        )
+            transport=dict(
+                name="my-ebics",
+                type="ebics"
+            ),
+            data=dict(
+                ebicsURL=EBICS_URL,
+                hostID=HOST_ID,
+                partnerID=PARTNER_ID,
+                userID=USER_ID
+            )
+        ),
+        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
     )
 )
-#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)
     )
 )
 
-#2.b
+#2.b, download keys from the bank (HPB)
 assertResponse(
     post(
-        "http://localhost:5001/ebics/subscribers/{}/sync".format(USERNAME),
-        json=dict()
+        "http://localhost:5001/bank-transports/syncHPB";,
+        json=dict(
+          type="ebics",
+          name="my-ebics"
+        ),
+        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
     )
 )
 
-#2.c
+#2.c, fetch bank account information
 assertResponse(
     post(
-        
"http://localhost:5001/ebics/subscribers/{}/fetch-accounts".format(USERNAME),
-        json=dict()
+        "http://localhost:5001/bank-transports/syncHTD";,
+        json=dict(
+          type="ebics",
+          name="my-ebics"
+        ),
+        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
     )
 )
 
-#3
+#3, ask nexus to download history
 assertResponse(
     post(
-        
"http://localhost:5001/ebics/subscribers/{}/collect-transactions-c53".format(USERNAME),
-        json=dict()
+        "http://localhost:5001/bank-accounts/collected-transactions";,
+        json=dict(
+          type="ebics",
+          name="my-ebics"
+        ),
+        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
     )
 )
 
-#4
+#4, make sure history is empty
 resp = assertResponse(
     get(
-        "http://localhost:5001/users/{}/history".format(USERNAME)
+        
"http://localhost:5001/bank-accounts/{}/collected-transactions".format(BANK_ACCOUNT_LABEL),
+        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
     )
 )
-assert(len(resp.json().get("payments")) == 0)
+assert(len(resp.json().get("transactions")) == 0)
 
-#5.a
-assertResponse(
+#5.a, prepare a payment
+resp = assertResponse(
     post(
-        "http://localhost:5001/users/{}/prepare-payment".format(USERNAME),
+        
"http://localhost:5001/bank-accounts/{}/prepared-payments".format(BANK_ACCOUNT_LABEL),
         json=dict(
-            creditorIban="FR7630006000011234567890189",
-            creditorBic="AGRIFRPP",
-            creditorName="Jacques La Fayette",
-            debitorIban=SUBSCRIBER_IBAN,
-            debitorBic=SUBSCRIBER_BIC,
-            debitorName=SUBSCRIBER_NAME,
-        subject="integration test",
-        sum=1
-        )
+            iban="FR7630006000011234567890189",
+            bic="AGRIFRPP",
+            name="Jacques La Fayette",
+            subject="integration test",
+            amount="EUR:1"
+        ),
+        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
     )
 )
+PREPARED_PAYMENT_UUID=resp.json().get("uuid")
+assert(PREPARED_PAYMENT_UUID != None)
 
-#5.b
+#5.b, submit prepared statement
 assertResponse(
-    post("http://localhost:5001/ebics/execute-payments";)
+    post(
+        "http://localhost:5001/bank-accounts/prepared-payments/submit";,
+        json=dict(uuid=PREPARED_PAYMENT_UUID),
+        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
+    )
 )
 
-#6
+#6, request history after payment submission
 assertResponse(
     post(
-        
"http://localhost:5001/ebics/subscribers/{}/collect-transactions-c53".format(USERNAME),
-        json=dict()
+        "http://localhost:5001/bank-accounts/collected-transactions";,
+        json=dict(),
+        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
     )
 )
 
 resp = assertResponse(
     get(
-        "http://localhost:5001/users/{}/history".format(USERNAME)
+        
"http://localhost:5001/bank-accounts/{}/collected-transactions".format(BANK_ACCOUNT_LABEL),
+        headers=dict(Authorization=USER_AUTHORIZATION_HEADER)
     )
 )
-assert(len(resp.json().get("payments")) == 1)
+assert(len(resp.json().get("transactions")) == 1)
 
 nexus.terminate()
 sandbox.terminate()

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



reply via email to

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