libeufin

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

commit 271dd2d5ad4ee9352dc0fe9d9b732f9a7608c60b
parent bcc5d2fda5ffe866193fdc33b22489817e03bcbe
Author: Marcello Stanisci <ms@taler.net>
Date:   Thu, 30 Apr 2020 16:07:18 +0200

Integration test.

Bring tests up to HTD.

Diffstat:
Mintegration-tests/test-ebics.py | 60+++++++++++++++++++++++++++++++-----------------------------
Mnexus/src/main/kotlin/tech/libeufin/nexus/DB.kt | 3++-
Msandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt | 3++-
Msandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 1+
4 files changed, 36 insertions(+), 31 deletions(-)

diff --git a/integration-tests/test-ebics.py b/integration-tests/test-ebics.py @@ -4,24 +4,27 @@ from requests import post, get # Steps implemented in this test. # -# 1 Prepare the Sandbox to run the test. +# 0 Prepare sandbox. # -> (a) Make a EBICS host, (b) make a EBICS subscriber # for the test runner, and (c) assign a IBAN to such # subscriber. # -# 2 Prepare the Nexus to run the test. +# 1 Prepare nexus. # -> (a) Make a Nexus user, (b) make a EBICS subscriber -# associated to that user, and (c) fetch the bank -# account owned by that subscriber at the bank. +# associated to that user # -# 3 Upload keys from Nexus to the Bank (INI & HIA) -# 4 Download key from the Bank (HPB) to the Nexus -# -# 5 Request history from the Nexus to the Bank (C53). -# 6 Verify that history is empty. -# 7 Issue a payment from Nexus (Prepare & trigger CCT) -# 8 Request history again, from Nexus to Bank. -# 9 Verify that previous payment shows up. +# 2 Prepare the Ebics transport for the nexus user. +# -> (a) Upload keys from Nexus to the Bank (INI & HIA), +# (b) Download key from the Bank (HPB) to the Nexus, +# and (c) Fetch the bank account owned by that subscriber +# at the bank. + +# 3 Request history from the Nexus to the Bank (C53). +# 4 Verify that history is empty. +# 5 Issue a payment from Nexus +# -> (a) Prepare & (b) trigger CCT. +# 6 Request history again, from Nexus to Bank. +# 7 Verify that previous payment shows up. # Nexus user details @@ -63,7 +66,7 @@ resp = post( assert(resp.status_code == 200) -#0.c, WIP +#0.c resp = post( "http://localhost:5000/admin/ebics-subscriber/bank-account", json=dict( @@ -74,15 +77,13 @@ resp = post( ), iban=SUBSCRIBER_IBAN, bic=SUBSCRIBER_BIC, - name=SUBSCRIBER_NAME + name=SUBSCRIBER_NAME, label=BANK_ACCOUNT_LABEL ) ) - assert(resp.status_code == 200) -#1 Create a Nexus user - +#1.a resp = post( "http://localhost:5001/users/{}".format(USERNAME), json=dict( @@ -92,7 +93,7 @@ resp = post( assert(resp.status_code == 200) -#2 Create a EBICS user +#1.b resp = post( "http://localhost:5001/ebics/subscribers/{}".format(USERNAME), json=dict( @@ -105,30 +106,35 @@ resp = post( assert(resp.status_code == 200) -#3 Upload keys to the bank INI & HIA +#2.a resp = post( "http://localhost:5001/ebics/subscribers/{}/sendINI".format(USERNAME), json=dict() ) - assert(resp.status_code == 200) resp = post( "http://localhost:5001/ebics/subscribers/{}/sendHIA".format(USERNAME), json=dict() ) - assert(resp.status_code == 200) -#4 Download keys from the bank HPB +#2.b resp = post( "http://localhost:5001/ebics/subscribers/{}/sync".format(USERNAME), json=dict() ) +assert(resp.status_code == 200) +#2.c +resp = post( + "http://localhost:5001/ebics/subscribers/{}/fetch-accounts".format(USERNAME), + json=dict() +) assert(resp.status_code == 200) +exit(77) -#5 Request history via EBICS +#3 Request history via EBICS resp = post( "http://localhost:5001/ebics/subscribers/{}/collect-transactions-c53".format(USERNAME), json=dict() @@ -140,17 +146,13 @@ resp = get( "http://localhost:5001/users/{}/history".format(USERNAME) ) +#4 assert( resp.status_code == 200 and \ len(resp.json().get("payments")) == 0 ) -#6 Prepare a payment (via pure Nexus service) - -# FIXME: this currently fails, because nexus has a -# empty table w.r.t. bank accounts. Thus, the sandbox -# must provide such information via the usual HTD message. - +#5.a resp = post( "http://localhost:5001/users/{}/prepare-payment".format(USERNAME), json=dict( diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt @@ -251,7 +251,8 @@ fun dbCreateTables() { RawBankTransactionsTable, TalerIncomingPayments, TalerRequestedPayments, - NexusUsersTable + NexusUsersTable, + EbicsToBankAccountsTable ) } } \ No newline at end of file diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt @@ -277,7 +277,8 @@ fun dbCreateTables() { EbicsUploadTransactionsTable, EbicsUploadTransactionChunksTable, EbicsOrderSignaturesTable, - PaymentsTable + PaymentsTable, + BankAccountsTable ) } } \ No newline at end of file diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt @@ -157,6 +157,7 @@ fun main() { iban = body.iban bic = body.bic name = body.name + label = body.label } } call.respondText(