summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMS <ms@taler.net>2020-09-08 14:16:26 +0200
committerMS <ms@taler.net>2020-09-08 14:16:26 +0200
commit0c3208483bf2d8984ef20f2fc416ef31865197a6 (patch)
tree51bcf18811e07d3e101e01ad4b948afc22f6f3a2
parent60f36bba98bcf6ec3c51fc2d4dd88a42771891ff (diff)
downloadlibeufin-0c3208483bf2d8984ef20f2fc416ef31865197a6.tar.gz
libeufin-0c3208483bf2d8984ef20f2fc416ef31865197a6.tar.bz2
libeufin-0c3208483bf2d8984ef20f2fc416ef31865197a6.zip
reduce code
-rwxr-xr-xintegration-tests/start-testenv.py14
-rwxr-xr-xintegration-tests/test-bankAccount.py14
-rwxr-xr-xintegration-tests/test-bankConnection.py14
-rwxr-xr-xintegration-tests/test-ebics-backup.py12
-rwxr-xr-xintegration-tests/test-ebics-double-payment-submission.py9
-rwxr-xr-xintegration-tests/test-ebics-highlevel.py14
-rwxr-xr-xintegration-tests/test-ebics.py13
-rwxr-xr-xintegration-tests/test-sandbox.py12
-rwxr-xr-xintegration-tests/test-taler-facade.py12
-rw-r--r--integration-tests/util.py7
10 files changed, 16 insertions, 105 deletions
diff --git a/integration-tests/start-testenv.py b/integration-tests/start-testenv.py
index 95569469..1fde4ee2 100755
--- 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
index 6045f3dc..a640aa86 100755
--- 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
index c1bd264d..02571a59 100755
--- 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
index d6bbcf27..9b09db17 100755
--- 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
index 32493a20..ccaf8c8f 100755
--- 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
index da4306c9..4d4f2933 100755
--- 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
index 5b5c2563..aac20d7c 100755
--- 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
index fd6a1f35..cbb44952 100755
--- 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
index 97e50190..0c1052bc 100755
--- 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
index c0e5ab46..42ec249a 100644
--- 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