nexus-based tests

more preparation
This commit is contained in:
MS 2020-06-02 14:58:30 +02:00
parent f6e1583016
commit 71eeb72b21
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
2 changed files with 76 additions and 12 deletions

View File

@ -5,6 +5,21 @@ from requests import get, post
from subprocess import call from subprocess import call
import base64 import base64
# EBICS details
EBICS_URL = "http://localhost:5000/ebicsweb"
HOST_ID = "HOST01"
PARTNER_ID = "PARTNER1"
USER_ID = "USER1"
EBICS_VERSION = "H004"
SUBSCRIBER_IBAN = "ES9121000418450200051332"
SUBSCRIBER_BIC = "BIC"
SUBSCRIBER_NAME = "Exchange"
BANK_ACCOUNT_LABEL = "my-bank-account"
BANK_CONNECTION_LABEL = "my-bank-connection"
FACADE_LABEL="my-facade"
USERNAME="Exchange" USERNAME="Exchange"
USER_AUTHORIZATION_HEADER = "basic {}".format( USER_AUTHORIZATION_HEADER = "basic {}".format(
base64.b64encode(b"Exchange:x").decode("utf-8") base64.b64encode(b"Exchange:x").decode("utf-8")
@ -27,30 +42,28 @@ assertResponse(
post( post(
"http://localhost:5001/bank-connections", "http://localhost:5001/bank-connections",
json=dict( json=dict(
name="my-loopback", name=BANK_CONNECTION_LABEL,
source="new", source="new",
type="loopback", type="ebics",
data=dict( data=dict(
account="my-bank-account", ebicsURL=EBICS_URL, hostID=HOST_ID, partnerID=PARTNER_ID, userID=USER_ID
iban="x", ),
bic="x",
holder="x",
)
), ),
headers=dict(Authorization=USER_AUTHORIZATION_HEADER), headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
) )
) )
# Create a facade # Create a facade
assertResponse( assertResponse(
post( post(
"http://localhost:5001/facades", "http://localhost:5001/facades",
json=dict( json=dict(
name="my-facade", name=FACADE_LABEL,
type="taler-wire-gateway", type="taler-wire-gateway",
creator=USERNAME, creator=USERNAME,
config=dict( config=dict(
bankAccount="my-bank-account", bankAccount=BANK_ACCOUNT_LABEL,
bankConnection="my-local", bankConnection=BANK_CONNECTION_LABEL,
reserveTransferLevel="UNUSED", reserveTransferLevel="UNUSED",
intervalIncremental="UNUSED" intervalIncremental="UNUSED"
) )
@ -58,3 +71,52 @@ assertResponse(
headers=dict(Authorization=USER_AUTHORIZATION_HEADER), headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
) )
) )
# Create the EBICS host at the Sandbox.
assertResponse(
post(
"http://localhost:5000/admin/ebics/host",
json=dict(hostID=HOST_ID, ebicsVersion=EBICS_VERSION),
)
)
# Create Exchange EBICS subscriber at the Sandbox.
assertResponse(
post(
"http://localhost:5000/admin/ebics/subscribers",
json=dict(hostID=HOST_ID, partnerID=PARTNER_ID, userID=USER_ID),
)
)
# Create a bank account associated to the Exchange's EBICS subscriber,
# again at the Sandbox.
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,
),
)
)
# 'connect' to the bank: upload+download keys.
assertResponse(
post(
"http://localhost:5001/bank-connections/{}/connect".format(BANK_CONNECTION_LABEL),
json=dict(),
headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
)
)
# Download bank accounts.
assertResponse(
post(
"http://localhost:5001/bank-connections/{}/ebics/import-accounts".format(BANK_CONNECTION_LABEL),
json=dict(),
headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
)
)

View File

@ -158,6 +158,8 @@ TALER_TESTING_run_libeufin (const struct TALER_TESTING_BankConfiguration *bc)
iter++; iter++;
} }
while (0 != system (curl_check_cmd)); while (0 != system (curl_check_cmd));
// start sandbox.
GNUNET_free (curl_check_cmd); GNUNET_free (curl_check_cmd);
fprintf (stderr, "\n"); fprintf (stderr, "\n");
@ -176,7 +178,7 @@ TALER_TESTING_run_libeufin (const struct TALER_TESTING_BankConfiguration *bc)
/* give child time to start and bind against the socket */ /* give child time to start and bind against the socket */
fprintf (stderr, fprintf (stderr,
"Waiting for `sandbox' to be ready..\n"); "Waiting for `sandbox' to be ready.\n");
iter = 0; iter = 0;
do do
{ {
@ -196,7 +198,7 @@ TALER_TESTING_run_libeufin (const struct TALER_TESTING_BankConfiguration *bc)
sleep (1); sleep (1);
iter++; iter++;
} }
while (0 != system ("curl http://localhost:5001/")); while (0 != system ("curl -s http://localhost:5000/"));
fprintf (stderr, "\n"); fprintf (stderr, "\n");
// Creates nexus user + bank loopback connection + Taler facade. // Creates nexus user + bank loopback connection + Taler facade.