gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: more types checked


From: gnunet
Subject: [libeufin] branch master updated: more types checked
Date: Tue, 08 Sep 2020 18:46:11 +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 f3a2bf6  more types checked
f3a2bf6 is described below

commit f3a2bf68bef89428d7a3885531b1780d51f6a81b
Author: MS <ms@taler.net>
AuthorDate: Tue Sep 8 18:46:05 2020 +0200

    more types checked
---
 integration-tests/json_checks.py   | 29 +++++++++++++++++++++++++++++
 integration-tests/start-testenv.py | 11 ++++++-----
 2 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/integration-tests/json_checks.py b/integration-tests/json_checks.py
new file mode 100644
index 0000000..10a3d0b
--- /dev/null
+++ b/integration-tests/json_checks.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+
+# This minimal library checks only if the JSON values
+# contains the expected fields, without actually checking
+# if the fields' value match the API.
+
+from util import CheckJsonField as F, CheckJsonTop as T
+
+def checkNewUserRequest(json):
+    c = T(F("username"), F("password"))
+    return c.check(json)
+
+def checkNewEbicsConnection(json):
+    c = T(
+            F("source"),
+            F("name"),
+            F("type"),
+            F("data", T(
+                F("ebicsURL"),
+                F("hostID"),
+                F("partnerID"),
+                F("userID"),
+            ))
+    )
+    return c.check(json)
+
+def checkImportAccount(json):
+    c = T(F("nexusBankAccountId"), F("offeredAccountId"))
+    return c.check(json)
diff --git a/integration-tests/start-testenv.py 
b/integration-tests/start-testenv.py
index 1fde4ee..634b93e 100755
--- a/integration-tests/start-testenv.py
+++ b/integration-tests/start-testenv.py
@@ -7,6 +7,7 @@ import os
 import socket
 import hashlib
 import base64
+from json_checks import checkNewUserRequest, checkNewEbicsConnection, 
checkImportAccount
 from util import startNexus, startSandbox, assertResponse
 
 # Nexus user details
@@ -258,7 +259,7 @@ assertResponse(
     post(
         "http://localhost:5001/users";,
         headers=dict(Authorization=ADMIN_AUTHORIZATION_HEADER),
-        json=dict(username=USERNAME, password=PASSWORD),
+        json=checkNewUserRequest(dict(username=USERNAME, password=PASSWORD)),
     )
 )
 
@@ -268,14 +269,14 @@ print("creating bank connection")
 assertResponse(
     post(
         "http://localhost:5001/bank-connections";,
-        json=dict(
+        json=checkNewEbicsConnection(dict(
             name="my-ebics-1",
             source="new",
             type="ebics",
             data=dict(
                 ebicsURL=EBICS_URL, hostID=BC1_HOST_ID, 
partnerID=BC1_PARTNER_ID, userID=BC1_USER_ID
             ),
-        ),
+        )),
         headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
     )
 )
@@ -375,10 +376,10 @@ assertResponse(
 assertResponse(
     post(
         "http://localhost:5001/bank-connections/my-ebics-1/import-account";,
-        json=dict(
+        json=checkImportAccount(dict(
           offeredAccountId=BC1_SUBSCRIBER1_BANK_ACCOUNT_LABEL,
           nexusBankAccountId=BC1_SUBSCRIBER1_BANK_ACCOUNT_LABEL
-        ),
+        )),
         headers=dict(Authorization=USER_AUTHORIZATION_HEADER),
     )
 )

-- 
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]