summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMS <ms@taler.net>2020-06-01 14:17:05 +0200
committerMS <ms@taler.net>2020-06-01 14:17:05 +0200
commit7f14b23914e43c3062facfd82f4430be218a9b2a (patch)
tree34055670d3bc0472971339852cdcd2d792de2917 /contrib
parent45943c22c269384b70f33fe16e58ac5b0ed8c492 (diff)
downloadexchange-7f14b23914e43c3062facfd82f4430be218a9b2a.tar.gz
exchange-7f14b23914e43c3062facfd82f4430be218a9b2a.tar.bz2
exchange-7f14b23914e43c3062facfd82f4430be218a9b2a.zip
Nexus testing.
Up to the point where Nexus gets launched and the Exchange user & bank connection get created. The test fails because the bank connection of type "loopback" is not implemented in the nexus yet.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/Makefile.am3
-rwxr-xr-xcontrib/taler-nexus-prepare57
2 files changed, 59 insertions, 1 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 2e1160f5..b706202d 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -27,7 +27,8 @@ rdata_DATA = \
bin_SCRIPTS = \
taler-bank-manage-testing \
- taler-exchange-revoke
+ taler-exchange-revoke \
+ taler-nexus-prepare
EXTRA_DIST = \
$(bin_SCRIPTS) \
diff --git a/contrib/taler-nexus-prepare b/contrib/taler-nexus-prepare
new file mode 100755
index 00000000..3e30d393
--- /dev/null
+++ b/contrib/taler-nexus-prepare
@@ -0,0 +1,57 @@
+#!/usr/bin/env python3
+# This file is in the public domain.
+
+from requests import get, post
+from subprocess import call
+import base64
+
+USERNAME="Exchange"
+USER_AUTHORIZATION_HEADER = "basic {}".format(
+ base64.b64encode(b"Exchange:x").decode("utf-8")
+)
+
+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
+
+# Create a nexus (super-) user
+call(["nexus", "superuser", "Exchange", "--password", "x"])
+# Create a loopback bank connection.
+assertResponse(
+ post(
+ "http://localhost:5001/bank-connections",
+ json=dict(
+ name="my-local",
+ source="new",
+ type="local",
+ data=dict(
+ bankAccount="my-bank-account"
+ )
+ ),
+ headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
+ )
+)
+# Create a facade
+assertResponse(
+ post(
+ "http://localhost:5001/facades",
+ json=dict(
+ name="my-facade",
+ type="taler-wire-gateway",
+ creator=USERNAME,
+ config=dict(
+ bankAccount="my-bank-account",
+ bankConnection="my-local",
+ reserveTransferLevel="UNUSED",
+ intervalIncremental="UNUSED"
+ )
+ ),
+ headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
+ )
+)