libeufin

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

commit c93a9c8d2de4507e9e5410d77a8c2e031b2830bc
parent c68736764f88910a64a6b414f42cfabad32d2018
Author: MS <ms@taler.net>
Date:   Fri,  4 Sep 2020 18:44:32 +0200

fix nested checks

Diffstat:
Mintegration-tests/test-ebics-backup.py | 15+++++++++++----
Mintegration-tests/util.py | 6+++---
2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/integration-tests/test-ebics-backup.py b/integration-tests/test-ebics-backup.py @@ -8,7 +8,7 @@ import socket import hashlib import base64 -from util import startNexus, startSandbox, CheckJsonTop as V, CheckJsonField as F +from util import startNexus, startSandbox, CheckJsonTop as T, CheckJsonField as F # Steps implemented in this test. # @@ -104,7 +104,7 @@ assertResponse( post( "http://localhost:5001/users", headers=dict(Authorization=ADMIN_AUTHORIZATION_HEADER), - json=V(F("username"), F("password")).check( + json=T(F("username"), F("password")).check( dict(username=USERNAME, password=PASSWORD)), ) ) @@ -112,17 +112,24 @@ assertResponse( print("creating bank connection") # 1.b, make a ebics bank connection for the new user. +check_bankConnection_request = T( + F("source"), + F("name"), + F("data", T( + F("ebicsURL"), F("hostID"), F("partnerID"), F("userID") + )) +) assertResponse( post( "http://localhost:5001/bank-connections", - json=dict( + json=check_bankConnection_request.check(dict( name="my-ebics", source="new", type="ebics", data=dict( ebicsURL=EBICS_URL, hostID=HOST_ID, partnerID=PARTNER_ID, userID=USER_ID ), - ), + )), headers=dict(Authorization=USER_AUTHORIZATION_HEADER), ) ) diff --git a/integration-tests/util.py b/integration-tests/util.py @@ -9,7 +9,7 @@ from pathlib import Path import sys class CheckJsonField: - def __init__(self, name, nested = []): + def __init__(self, name, nested = None): self.name = name self.nested = nested @@ -17,8 +17,8 @@ class CheckJsonField: if self.name not in json: print(f"'{self.name}' not found in the JSON.") sys.exit(1) - for nested_check in self.nested: - self.nested_check.check(json.get(self.name)) + if self.nested: + self.nested.check(json.get(self.name)) class CheckJsonTop: def __init__(self, *args):