libeufin

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

commit d025bc5b1ee362a152709f55485c4fd634babaa6
parent bffb1419c23708dd9fd474ef8b444befa9c6af89
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Thu,  3 Oct 2019 17:48:06 +0200

no mock

Diffstat:
Msrc/main/python/libeufin-cli | 35+++++++++--------------------------
1 file changed, 9 insertions(+), 26 deletions(-)

diff --git a/src/main/python/libeufin-cli b/src/main/python/libeufin-cli @@ -41,6 +41,7 @@ def customers(obj): resp = post(url, json=dict(name=name)) except Exception: print("Could not reach the bank") + return # use the customer id contained in the response to # query for your details. @@ -95,36 +96,18 @@ def customer_info(obj, customer_id): "--customer-id", help="id of the customer at the bank (used to pick keyset on disk)" ) -@click.option( - "--mock-info", - is_flag=True, - help="Mocks customer details instead of requesting ebics-info") @click.pass_obj -def keyletter(obj, customer_id, mock_info): +def keyletter(obj, customer_id): - if not mock_info and not customer_id: - print("Need --customer-id when not mocking ebics-info, aborting") + try: + url = urljoin( + obj["base_url"], "/admin/customers/{}".format(customer_id) + ) + resp = get(url) + except Exception: + print("Could not connect to the bank, aborting") return - resp = MagicMock() - resp.status_code = 200 - resp.json.return_value = dict( - name="Mock Name", - ebicsInfo=dict(userId="u1") - ) - - if mock_info: - print("Mocking ebics-info") - else: - try: - url = urljoin( - obj["base_url"], "/admin/customers/{}".format(customer_id) - ) - resp = get(url) - except Exception: - print("Could not connect to the bank, aborting") - return - assert(resp.status_code == 200) user_id = resp.json().get("ebicsInfo", {}).get("userId") name = resp.json().get("name")