[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: sandbox test
From: |
gnunet |
Subject: |
[libeufin] branch master updated: sandbox test |
Date: |
Wed, 20 May 2020 16:10:05 +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 b8c09df sandbox test
b8c09df is described below
commit b8c09dffafac5404b20302368a0c2ceb8c41f8ec
Author: MS <address@hidden>
AuthorDate: Wed May 20 16:10:00 2020 +0200
sandbox test
---
integration-tests/test-sandbox.py | 109 ++++++++++++++++++++++++++++++++++++++
1 file changed, 109 insertions(+)
diff --git a/integration-tests/test-sandbox.py
b/integration-tests/test-sandbox.py
new file mode 100755
index 0000000..4cb5800
--- /dev/null
+++ b/integration-tests/test-sandbox.py
@@ -0,0 +1,109 @@
+#!/usr/bin/env python3
+
+from requests import post, get
+from subprocess import call, Popen, PIPE
+from time import sleep
+import os
+import socket
+import hashlib
+import base64
+
+# 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 fail(msg):
+ print(msg)
+ nexus.terminate()
+ sandbox.terminate()
+ exit(1)
+
+
+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 the service.
+os.chdir("..")
+assert 0 == call(["rm", "-f", "sandbox/libeufin-sandbox.sqlite3"])
+DEVNULL = open(os.devnull, "w")
+
+# 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
+
+# Create a Ebics host.
+assertResponse(
+ post(
+ "http://localhost:5000/admin/ebics/host",
+ json=dict(hostID=HOST_ID, ebicsVersion=EBICS_VERSION),
+ )
+)
+
+# Create a new subscriber.
+assertResponse(
+ post(
+ "http://localhost:5000/admin/ebics/subscribers",
+ json=dict(hostID=HOST_ID, partnerID=PARTNER_ID, userID=USER_ID),
+ )
+)
+
+# Assign a bank account to such subscriber.
+assertResponse(
+ post(
+ "http://localhost:5000/admin/ebics/bank-accounts",
+ 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,
+ ),
+ )
+)
+sandbox.terminate()
+print("Test passed!")
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: sandbox test,
gnunet <=