gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] 05/06: Testing backup generation and import.


From: gnunet
Subject: [libeufin] 05/06: Testing backup generation and import.
Date: Sun, 15 Nov 2020 22:06:56 +0100

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

ms pushed a commit to branch master
in repository libeufin.

commit 411798c1a1dfcec1a66c1737f83d7de26865ef61
Author: MS <ms@taler.net>
AuthorDate: Sun Nov 15 05:59:55 2020 +0100

    Testing backup generation and import.
---
 integration-tests/tests.py | 22 +++++++++++++++++++++-
 integration-tests/util.py  | 37 +++++++++++++++++++++----------------
 2 files changed, 42 insertions(+), 17 deletions(-)

diff --git a/integration-tests/tests.py b/integration-tests/tests.py
index 40979dc..73ed556 100755
--- a/integration-tests/tests.py
+++ b/integration-tests/tests.py
@@ -1,12 +1,14 @@
 #!/usr/bin/env python3
 
 from requests import post, get, auth
+from time import sleep
 from util import (
     startNexus,
     startSandbox,
     assertResponse,
     flushTablesSandbox,
-    flushTablesNexus
+    flushTablesNexus,
+    makeNexusSuperuser
 )
 
 # Databases
@@ -66,6 +68,7 @@ def prepareSandbox():
     )
 
 def prepareNexus():
+    makeNexusSuperuser(NEXUS_DB)
     # make a new nexus user.
     assertResponse(
         post(
@@ -139,3 +142,20 @@ def test_empty_history():
         )
     )
     assert len(resp.json().get("transactions")) == 0
+
+def test_backup():
+    resp = assertResponse(
+        post(
+            
f"http://localhost:5001/bank-connections/{NEXUS_BANK_CONNECTION}/export-backup";,
+            json=dict(passphrase="secret"),
+            auth=NEXUS_AUTH
+        )
+    )
+    sleep(3)
+    assertResponse(
+        post(
+            "http://localhost:5001/bank-connections";,
+            json=dict(name="my-ebics-restored", data=resp.json(), 
passphrase="secret", source="backup"),
+            auth=NEXUS_AUTH
+        )
+    )
diff --git a/integration-tests/util.py b/integration-tests/util.py
index af90c40..df01702 100644
--- a/integration-tests/util.py
+++ b/integration-tests/util.py
@@ -46,10 +46,24 @@ def kill(name, s):
     s.terminate()
     s.wait()
 
+def makeNexusSuperuser(dbName):
+    db_full_path = str(Path.cwd() / dbName)
+    check_call(
+        [
+            "../gradlew",
+            "-p",
+            "..",
+            "nexus:run",
+            "--console=plain",
+            f"--args=superuser admin --password x --db-name={db_full_path}",
+        ]
+    )
+
 def flushTablesSandbox(dbName):
+    db_full_path = str(Path.cwd() / dbName)
     check_call(
         ["sqlite3",
-         dbName,
+         db_full_path,
          "DELETE FROM BankAccountReports",
          "DELETE FROM EbicsOrderSignatures",
          "DELETE FROM BankAccountStatements",
@@ -65,9 +79,10 @@ def flushTablesSandbox(dbName):
      )
 
 def flushTablesNexus(dbName):
+    db_full_path = str(Path.cwd() / dbName)
     check_call(
         ["sqlite3",
-         dbName,
+         db_full_path,
          "DELETE FROM EbicsSubscribers",
          "DELETE FROM NexusBankTransactions",
          "DELETE FROM TalerFacadeState",
@@ -84,8 +99,8 @@ def flushTablesNexus(dbName):
         ]
     )
 
-def startSandbox(dbname="sandbox-test.sqlite3"):
-    db_full_path = str(Path.cwd() / dbname)
+def startSandbox(dbName="sandbox-test.sqlite3"):
+    db_full_path = str(Path.cwd() / dbName)
     check_call(["rm", "-f", db_full_path])
     check_call(["../gradlew", "-p", "..", "sandbox:assemble"])
     checkPort(5000)
@@ -110,22 +125,12 @@ def startSandbox(dbname="sandbox-test.sqlite3"):
         break
 
 
-def startNexus(dbname="nexus-test.sqlite3"):
-    db_full_path = str(Path.cwd() / dbname)
+def startNexus(dbName="nexus-test.sqlite3"):
+    db_full_path = str(Path.cwd() / dbName)
     check_call(["rm", "-f", "--", db_full_path])
     check_call(
         ["../gradlew", "-p", "..", "nexus:assemble",]
     )
-    check_call(
-        [
-            "../gradlew",
-            "-p",
-            "..",
-            "nexus:run",
-            "--console=plain",
-            "--args=superuser admin --password x 
--db-name={}".format(db_full_path),
-        ]
-    )
     checkPort(5001)
     nexus = Popen(
         [

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