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.
This commit is contained in:
parent
45943c22c2
commit
7f14b23914
@ -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) \
|
||||
|
57
contrib/taler-nexus-prepare
Executable file
57
contrib/taler-nexus-prepare
Executable file
@ -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),
|
||||
)
|
||||
)
|
@ -6,11 +6,11 @@ currency = KUDOS
|
||||
[exchange-account-2]
|
||||
PAYTO_URI = payto://iban/IBAN/UNUSED
|
||||
METHOD = x-taler-bank
|
||||
WIRE_GATEWAY_URL = http://localhost:5001/facades/made-up-facade-id/taler
|
||||
WIRE_GATEWAY_URL = http://localhost:5001/facades/my-facade/taler/
|
||||
WIRE_GATEWAY_AUTH_METHOD = basic
|
||||
# the exchange authenticates as the 'admin' user,
|
||||
# since that makes the test preparation just easier.
|
||||
USERNAME = admin
|
||||
USERNAME = Exchange
|
||||
PASSWORD = x
|
||||
|
||||
[bank]
|
||||
|
@ -106,7 +106,6 @@ TALER_TESTING_has_in_name (const char *prog,
|
||||
* bank" function to do such tasks. This function is also
|
||||
* responsible to create the exchange user at Nexus.
|
||||
*
|
||||
* @param config_filename configuration filename. Used to
|
||||
* @return the process, or NULL if the process could not
|
||||
* be started.
|
||||
*/
|
||||
@ -117,10 +116,6 @@ TALER_TESTING_run_nexus (const struct TALER_TESTING_BankConfiguration *bc)
|
||||
unsigned int iter;
|
||||
char *curl_check_cmd;
|
||||
|
||||
/* make the 'admin' user at nexus; note: this is the user
|
||||
under which the exchange will request the services. */
|
||||
system ("nexus superuser admin --password x");
|
||||
|
||||
bank_proc = GNUNET_OS_start_process
|
||||
(GNUNET_NO,
|
||||
GNUNET_OS_INHERIT_STD_NONE,
|
||||
@ -160,11 +155,16 @@ TALER_TESTING_run_nexus (const struct TALER_TESTING_BankConfiguration *bc)
|
||||
iter++;
|
||||
}
|
||||
while (0 != system (curl_check_cmd));
|
||||
|
||||
|
||||
GNUNET_free (curl_check_cmd);
|
||||
fprintf (stderr, "\n");
|
||||
|
||||
// Creates nexus user + bank loopback connection + Taler facade.
|
||||
if (0 != system ("taler-nexus-prepare"))
|
||||
{
|
||||
GNUNET_OS_process_kill (bank_proc, SIGTERM);
|
||||
GNUNET_OS_process_wait (bank_proc);
|
||||
GNUNET_OS_process_destroy (bank_proc);
|
||||
BANK_FAIL ();
|
||||
}
|
||||
return bank_proc;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user