libeufin

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

commit 5259e4fe09c41132303ed90a4eb9a6dc3eb2e31d
parent eb445828f75e1e44c11e3aae0b1b25e4c3e48e50
Author: MS <ms@taler.net>
Date:   Mon, 14 Dec 2020 09:56:22 +0100

Use helper, fix names.

Diffstat:
Mintegration-tests/tests.py | 23+++++++++--------------
Mintegration-tests/util.py | 15+++++++++------
2 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/integration-tests/tests.py b/integration-tests/tests.py @@ -23,12 +23,12 @@ from util import ( # Database DB = "jdbc:sqlite:/tmp/libeufintestdb" SANDBOX_URL = "http://localhost:5000" -NEXUS_URL = "http://localhost:5000" +NEXUS_URL = "http://localhost:5001" PERSONA = LibeufinPersona( banking_details = BankingDetails(SANDBOX_URL), nexus_details = NexusDetails(NEXUS_URL), - ebics_details = EbicsDetails(SANDBOX_URL) + ebics_details = EbicsDetails(SANDBOX_URL + "/ebicsweb") ) def prepareSandbox(): @@ -36,14 +36,14 @@ def prepareSandbox(): assertResponse( post( f"{PERSONA.banking.bank_base_url}/admin/ebics/host", - json=dict(hostID=PERSONA.banking.ebics.host, ebicsVersion=PERSONA.banking.ebics.version), + json=dict(hostID=PERSONA.ebics.host, ebicsVersion=PERSONA.ebics.version), ) ) # make new ebics subscriber at sandbox assertResponse( post( f"{PERSONA.banking.bank_base_url}/admin/ebics/subscribers", - json=PERSONA.banking.ebics.get_as_dict(), + json=PERSONA.ebics.get_as_dict(with_url=False), ) ) # give a bank account to such subscriber, at sandbox @@ -52,10 +52,10 @@ def prepareSandbox(): f"{PERSONA.banking.bank_base_url}/admin/ebics/bank-accounts", json=dict( name=PERSONA.banking.name, - subscriber=PERSONA.banking.ebics.get_as_dict(), + subscriber=PERSONA.ebics.get_as_dict(with_url=False), iban=PERSONA.banking.iban, bic=PERSONA.banking.bic, - label=PERSONA.banking.sandbox_label + label=PERSONA.banking.label ) ) ) @@ -78,7 +78,7 @@ def prepareNexus(): name=PERSONA.nexus.bank_connection, source="new", type="ebics", - data=PERSONA.banking.ebics.get_as_dict(), + data=PERSONA.ebics.get_as_dict(with_url=True), ), auth=PERSONA.nexus.auth ) @@ -104,7 +104,7 @@ def prepareNexus(): post( f"{PERSONA.nexus.base_url}/bank-connections/{PERSONA.nexus.bank_connection}/import-account", json=dict( - offeredAccountId=PERSONA.banking.sandbox_label, + offeredAccountId=PERSONA.banking.label, nexusBankAccountId=PERSONA.nexus.bank_label ), auth=PERSONA.nexus.auth @@ -302,12 +302,7 @@ def test_double_connection_name(): name=PERSONA.nexus.bank_connection, source="new", type="ebics", - data=dict( - ebicsURL=PERSONA.banking.ebics.service_url, - hostID=PERSONA.banking.ebics.host, - partnerID=PERSONA.banking.ebics.partner, - userID=PERSONA.banking.ebics.user - ), + data=PERSONA.ebics.get_as_dict(with_url=True), ), auth=PERSONA.nexus.auth ), diff --git a/integration-tests/util.py b/integration-tests/util.py @@ -11,13 +11,15 @@ import sys import os class EbicsDetails: - def get_as_dict(self): - return dict( - ebicsURL=self.service_url, + def get_as_dict(self, with_url): + ret = dict( hostID=self.host, partnerID=self.partner, userID=self.user ) + if with_url: + ret.update(ebicsURL=self.service_url) + return ret def __init__(self, service_url): self.service_url = service_url @@ -190,6 +192,7 @@ def startNexus(dbConnString): break return nexus -def assertResponse(response, acceptedResponses=[200]): - assert response.status_code in acceptedResponses - return response +def assertResponse(r, acceptedResponses=[200]): + assert r.status_code in acceptedResponses, \ + f"Unexpected status code (r.status_code) from: {r.request.method} {r.url}" + return r