gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: Command 'drop-tables' becomes 'reset-t


From: gnunet
Subject: [libeufin] branch master updated: Command 'drop-tables' becomes 'reset-tables'.
Date: Thu, 10 Dec 2020 17:30:16 +0100

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 a878a33  Command 'drop-tables' becomes 'reset-tables'.
a878a33 is described below

commit a878a3350d90c7b34f7b734a63f89dec469fb528
Author: MS <ms@taler.net>
AuthorDate: Thu Dec 10 17:29:06 2020 +0100

    Command 'drop-tables' becomes 'reset-tables'.
    
    This makes it possible to avoid restarting the
    services between tests.
---
 integration-tests/tests.py                         | 44 ++--------------------
 integration-tests/util.py                          |  4 +-
 nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt  |  5 ++-
 .../src/main/kotlin/tech/libeufin/sandbox/Main.kt  |  5 ++-
 4 files changed, 11 insertions(+), 47 deletions(-)

diff --git a/integration-tests/tests.py b/integration-tests/tests.py
index ff3bcbb..bb4f06b 100755
--- a/integration-tests/tests.py
+++ b/integration-tests/tests.py
@@ -20,7 +20,9 @@ S = "http://localhost:5000";
 N = "http://localhost:5001";
 
 # Database
-DB = "jdbc:postgresql://127.0.0.1:5433/libeufintestdb?user=libeufin"
+DB_POSTGRES = "jdbc:postgresql://127.0.0.1:5433/libeufintestdb?user=libeufin"
+DB_SQLITE = "jdbc:sqlite:/tmp/libeufintestdb"
+DB = DB_SQLITE
 
 # Nexus user details
 NEXUS_USERNAME = "person"
@@ -288,46 +290,6 @@ def test_taler_facade():
     )
     assert len(resp.json().get("outgoing_transactions")) == 1
 
-def test_payment_double_submission():
-    resp = assertResponse(
-        post(
-            f"{N}/bank-accounts/{NEXUS_BANK_LABEL}/payment-initiations",
-            json=dict(
-                iban="FR7630006000011234567890189",
-                bic="AGRIFRPP",
-                name="Jacques La Fayette",
-                subject="integration test",
-                amount="EUR:1",
-            ),
-            auth=NEXUS_AUTH
-        )
-    )
-    PAYMENT_UUID = resp.json().get("uuid")
-    assert PAYMENT_UUID
-    assertResponse(
-        post(
-            
f"{N}/bank-accounts/{NEXUS_BANK_LABEL}/payment-initiations/{PAYMENT_UUID}/submit",
-            json=dict(),
-            auth=NEXUS_AUTH
-        )
-    )
-    check_call([
-        "psql", "-d", DB, "-h 127.0.0.1", "-U", "libeufin",
-        f"UPDATE PaymentInitiations SET submitted = false WHERE id = 
'{PAYMENT_UUID}'"
-    ]) 
-    # Submit payment the _second_ time, expecting 500 from Nexus.
-    # FIXME:
-    # Sandbox does return a EBICS_PROCESSING_ERROR code, but Nexus
-    # (currently) is not able to extract any meaning from it.  Ideally,
-    # Nexus should print both the error token _and_ a hint message.
-    assertResponse(
-        post(
-            
f"{N}/bank-accounts/{NEXUS_BANK_LABEL}/payment-initiations/{PAYMENT_UUID}/submit",
-            json=dict(),
-            auth=NEXUS_AUTH
-        ),
-        [500]
-    )
 
 def test_double_connection_name():
     assertResponse(
diff --git a/integration-tests/util.py b/integration-tests/util.py
index f9689aa..1492b1f 100644
--- a/integration-tests/util.py
+++ b/integration-tests/util.py
@@ -61,7 +61,7 @@ def dropSandboxTables(dbConnString):
         "-q", "--console=plain",
         "-p", "..",
         "sandbox:run",
-        f"--args=drop-tables --db-conn-string={dbConnString}"
+        f"--args=reset-tables --db-conn-string={dbConnString}"
     ])
 
 
@@ -71,7 +71,7 @@ def dropNexusTables(dbConnString):
         "-q", "--console=plain",
         "-p", "..",
         "nexus:run",
-        f"--args=drop-tables --db-conn-string={dbConnString}"
+        f"--args=reset-tables --db-conn-string={dbConnString}"
     ])
 
 
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index 5944c55..749e143 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -72,10 +72,11 @@ class ParseCamt : CliktCommand("Parse a camt file") {
     }
 }
 
-class DropTables : CliktCommand("Drop all the tables from the database") {
+class ResetTables : CliktCommand("Drop all the tables from the database") {
     private val dbConnString by option().default(DEFAULT_DB_CONNECTION)
     override fun run() {
         dbDropTables(dbConnString)
+        dbCreateTables(dbConnString)
     }
 }
 
@@ -106,6 +107,6 @@ class Superuser : CliktCommand("Add superuser or change 
pw") {
 
 fun main(args: Array<String>) {
     NexusCommand()
-        .subcommands(Serve(), Superuser(), ParseCamt(), DropTables())
+        .subcommands(Serve(), Superuser(), ParseCamt(), ResetTables())
         .main(args)
 }
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 6b6788d..cdc869d 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -90,10 +90,11 @@ class SandboxCommand : CliktCommand() {
     override fun run() = Unit
 }
 
-class DropTables : CliktCommand("Drop all the tables from the database") {
+class ResetTables : CliktCommand("Drop all the tables from the database") {
     private val dbConnString by option().default(DEFAULT_DB_CONNECTION)
     override fun run() {
         dbDropTables(dbConnString)
+        dbCreateTables(dbConnString)
     }
 }
 
@@ -153,7 +154,7 @@ fun BigDecimal.signToString(): String {
 
 fun main(args: Array<String>) {
     SandboxCommand()
-        .subcommands(Serve(), DropTables())
+        .subcommands(Serve(), ResetTables())
         .main(args)
 }
 

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