libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 0c3208483bf2d8984ef20f2fc416ef31865197a6
parent 60f36bba98bcf6ec3c51fc2d4dd88a42771891ff
Author: MS <ms@taler.net>
Date:   Tue,  8 Sep 2020 14:16:26 +0200

reduce code

Diffstat:
Mintegration-tests/start-testenv.py | 14+-------------
Mintegration-tests/test-bankAccount.py | 14+-------------
Mintegration-tests/test-bankConnection.py | 14+-------------
Mintegration-tests/test-ebics-backup.py | 12+-----------
Mintegration-tests/test-ebics-double-payment-submission.py | 9+--------
Mintegration-tests/test-ebics-highlevel.py | 14+-------------
Mintegration-tests/test-ebics.py | 13+------------
Mintegration-tests/test-sandbox.py | 12+-----------
Mintegration-tests/test-taler-facade.py | 12+-----------
Mintegration-tests/util.py | 7+++++++
10 files changed, 16 insertions(+), 105 deletions(-)

diff --git a/integration-tests/start-testenv.py b/integration-tests/start-testenv.py @@ -7,7 +7,7 @@ import os import socket import hashlib import base64 -from util import startNexus, startSandbox +from util import startNexus, startSandbox, assertResponse # Nexus user details USERNAME = "person" @@ -92,18 +92,6 @@ def fail(msg): print(msg) exit(1) - -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") - exit(1) - # Allows for finer grained checks. - return response - - startNexus("nexus-testenv.sqlite3") startSandbox() diff --git a/integration-tests/test-bankAccount.py b/integration-tests/test-bankAccount.py @@ -6,7 +6,7 @@ import os import hashlib import base64 -from util import startNexus, startSandbox +from util import startNexus, startSandbox, assertResponse # Nexus user details USERNAME = "person" @@ -41,18 +41,6 @@ def fail(msg): print(msg) exit(1) - -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") - exit(1) - # Allows for finer grained checks. - return response - - startNexus(NEXUS_DB) startSandbox() diff --git a/integration-tests/test-bankConnection.py b/integration-tests/test-bankConnection.py @@ -6,7 +6,7 @@ import os import hashlib import base64 -from util import startNexus, startSandbox +from util import startNexus, startSandbox, assertResponse # Nexus user details USERNAME = "person" @@ -41,18 +41,6 @@ def fail(msg): print(msg) exit(1) - -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") - exit(1) - # Allows for finer grained checks. - return response - - startNexus(NEXUS_DB) startSandbox() diff --git a/integration-tests/test-ebics-backup.py b/integration-tests/test-ebics-backup.py @@ -8,7 +8,7 @@ import socket import hashlib import base64 -from util import startNexus, startSandbox, CheckJsonTop as T, CheckJsonField as F +from util import startNexus, startSandbox, CheckJsonTop as T, CheckJsonField as F, assertResponse # Steps implemented in this test. # @@ -56,16 +56,6 @@ def fail(msg): print(msg) exit(1) -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") - exit(1) - # Allows for finer grained checks. - return response - startNexus(NEXUS_DB) startSandbox() diff --git a/integration-tests/test-ebics-double-payment-submission.py b/integration-tests/test-ebics-double-payment-submission.py @@ -7,7 +7,7 @@ import os import hashlib import base64 -from util import startNexus, startSandbox +from util import startNexus, startSandbox, assertResponse # Nexus user details USERNAME = "person" @@ -43,13 +43,6 @@ def fail(msg): exit(1) -def assertResponse(response, acceptedResponses=[200]): - if response.status_code not in acceptedResponses: - print("Test failed on URL: {}, status: {}/{}".format( - response.url, response.status_code, acceptedResponses)) - exit(1) - return response - startNexus(NEXUS_DB) startSandbox() diff --git a/integration-tests/test-ebics-highlevel.py b/integration-tests/test-ebics-highlevel.py @@ -6,7 +6,7 @@ import os import hashlib import base64 -from util import startNexus, startSandbox +from util import startNexus, startSandbox, assertResponse # Steps implemented in this test. # @@ -66,18 +66,6 @@ def fail(msg): print(msg) exit(1) - -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") - exit(1) - # Allows for finer grained checks. - return response - - startNexus(NEXUS_DB) startSandbox() diff --git a/integration-tests/test-ebics.py b/integration-tests/test-ebics.py @@ -8,7 +8,7 @@ import socket import hashlib import base64 -from util import startNexus, startSandbox +from util import startNexus, startSandbox, assertResponse # Steps implemented in this test. # @@ -67,20 +67,9 @@ def fail(msg): print(msg) exit(1) -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") - exit(1) - # Allows for finer grained checks. - return response - startSandbox() startNexus(NEXUS_DB) - # 0.a assertResponse( post( diff --git a/integration-tests/test-sandbox.py b/integration-tests/test-sandbox.py @@ -8,7 +8,7 @@ import socket import hashlib import base64 -from util import startSandbox +from util import startSandbox, assertResponse # EBICS details EBICS_URL = "http://localhost:5000/ebicsweb" @@ -28,16 +28,6 @@ def fail(msg): print(msg) exit(1) -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("Status code was: " + str(response.status_code)) - exit(1) - # Allows for finer grained checks. - return response - startSandbox() # Create a Ebics host. diff --git a/integration-tests/test-taler-facade.py b/integration-tests/test-taler-facade.py @@ -8,7 +8,7 @@ import socket import hashlib import base64 -from util import startNexus, startSandbox +from util import startNexus, startSandbox, assertResponse # Nexus user details USERNAME = "person" @@ -44,16 +44,6 @@ def fail(msg): print(msg) exit(1) -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") - exit(1) - # Allows for finer grained checks. - return response - startNexus(NEXUS_DB) startSandbox(SANDBOX_DB) diff --git a/integration-tests/util.py b/integration-tests/util.py @@ -116,3 +116,10 @@ def startNexus(dbname="nexus-test.sqlite3"): continue break return nexus + +def assertResponse(response, acceptedResponses=[200]): + if response.status_code not in acceptedResponses: + print("Test failed on URL: {}, status: {}".format( + response.url, response.status_code)) + exit(1) + return response