gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: documentation checks


From: gnunet
Subject: [libeufin] branch master updated: documentation checks
Date: Thu, 22 Oct 2020 15:21:26 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new b2e05de  documentation checks
b2e05de is described below

commit b2e05de586957ecfdde08d3a2af5a9db54675646
Author: MS <ms@taler.net>
AuthorDate: Thu Oct 22 15:21:06 2020 +0200

    documentation checks
---
 integration-tests/json_checks.py       | 28 +++++++++++++++++++++++++++-
 integration-tests/test-ebics-backup.py | 31 ++++++++++++++++---------------
 integration-tests/util.py              |  6 +++---
 3 files changed, 46 insertions(+), 19 deletions(-)

diff --git a/integration-tests/json_checks.py b/integration-tests/json_checks.py
index 10a3d0b..03e3404 100644
--- a/integration-tests/json_checks.py
+++ b/integration-tests/json_checks.py
@@ -25,5 +25,31 @@ def checkNewEbicsConnection(json):
     return c.check(json)
 
 def checkImportAccount(json):
-    c = T(F("nexusBankAccountId"), F("offeredAccountId"))
+    c = T(F("nexusBankAccountId"),
+          F("offeredAccountId"))
     return c.check(json)
+
+def checkSandboxEbicsHosts(json):
+    c = T(F("hostID"),
+          F("ebicsVersion"))
+    return c.check(json)
+
+def checkSandboxEbicsSubscriber(json):
+    c = T(F("hostID"),
+          F("userID"),
+          F("partnerID"),
+          F("systemID", optional=True))
+    return c.check(json)
+
+def checkSandboxBankAccount(json):
+    c = T(
+        F("iban"),
+        F("bic"),
+        F("name"),
+        F("subscriber"),
+        F("label")
+    )
+    return c.check(json)
+
+def checkBackupDetails(json):
+    return T(F("passphrase")).check(json)
diff --git a/integration-tests/test-ebics-backup.py 
b/integration-tests/test-ebics-backup.py
index 9b09db1..c45f5f2 100755
--- a/integration-tests/test-ebics-backup.py
+++ b/integration-tests/test-ebics-backup.py
@@ -9,6 +9,14 @@ import hashlib
 import base64
 
 from util import startNexus, startSandbox, CheckJsonTop as T, CheckJsonField 
as F, assertResponse
+from json_checks import (
+    checkSandboxEbicsHosts,
+    checkSandboxEbicsSubscriber,
+    checkSandboxBankAccount,
+    checkNewEbicsConnection,
+    checkNewUserRequest,
+    checkBackupDetails
+)
 
 # Steps implemented in this test.
 #
@@ -63,7 +71,7 @@ startSandbox()
 assertResponse(
     post(
         "http://localhost:5000/admin/ebics/host";,
-        json=dict(hostID=HOST_ID, ebicsVersion=EBICS_VERSION),
+        json=checkSandboxEbicsHosts(dict(hostID=HOST_ID, 
ebicsVersion=EBICS_VERSION)),
     )
 )
 
@@ -71,21 +79,22 @@ assertResponse(
 assertResponse(
     post(
         "http://localhost:5000/admin/ebics/subscribers";,
-        json=dict(hostID=HOST_ID, partnerID=PARTNER_ID, userID=USER_ID),
+        json=checkSandboxEbicsSubscriber(dict(hostID=HOST_ID, 
partnerID=PARTNER_ID, userID=USER_ID)),
     )
 )
 
 # 0.c
+
 assertResponse(
     post(
         "http://localhost:5000/admin/ebics/bank-accounts";,
-        json=dict(
+        json=checkSandboxBankAccount(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,
-        ),
+        )),
     )
 )
 
@@ -94,25 +103,17 @@ assertResponse(
     post(
         "http://localhost:5001/users";,
         headers=dict(Authorization=ADMIN_AUTHORIZATION_HEADER),
-        json=T(F("username"), F("password")).check(
-           dict(username=USERNAME, password=PASSWORD)),
+        json=checkNewUserRequest(dict(username=USERNAME, password=PASSWORD))
     )
 )
 
 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=check_bankConnection_request.check(dict(
+        json=checkNewEbicsConnection(dict(
             name="my-ebics",
             source="new",
             type="ebics",
@@ -129,7 +130,7 @@ print("saving a backup copy")
 resp = assertResponse(
     post(
         "http://localhost:5001/bank-connections/my-ebics/export-backup";,
-        json=dict(passphrase="secret"),
+        json=checkBackupDetails(dict(passphrase="secret")),
         headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
     )
 )
diff --git a/integration-tests/util.py b/integration-tests/util.py
index 42ec249..ab85cd6 100644
--- a/integration-tests/util.py
+++ b/integration-tests/util.py
@@ -9,12 +9,13 @@ from pathlib import Path
 import sys
 
 class CheckJsonField:
-    def __init__(self, name, nested = None):
+    def __init__(self, name, nested=None, optional=False):
         self.name = name
         self.nested = nested
+        self.optional = optional
 
     def check(self, json):
-        if self.name not in json:
+        if self.name not in json and not self.optional:
             print(f"'{self.name}' not found in the JSON.")
             sys.exit(1)
         if self.nested:
@@ -44,7 +45,6 @@ def kill(name, s):
     print(f"terminating {name} ...")
     s.terminate()
     s.wait()
-    print("terminated!")
 
 
 def startSandbox(dbname="sandbox-test.sqlite3"):

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]