gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated: expand testcase to


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: expand testcase to cover new DB API
Date: Thu, 20 Apr 2017 09:04:22 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 92d9ec6  expand testcase to cover new DB API
92d9ec6 is described below

commit 92d9ec69e6d8e9f7eb0be0d6a7f67444189b319e
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Apr 20 09:04:20 2017 +0200

    expand testcase to cover new DB API
---
 src/exchangedb/plugin_exchangedb_common.c | 12 +++++++++--
 src/exchangedb/test_exchangedb.c          | 36 ++++++++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/src/exchangedb/plugin_exchangedb_common.c 
b/src/exchangedb/plugin_exchangedb_common.c
index b97aa08..ba182d4 100644
--- a/src/exchangedb/plugin_exchangedb_common.c
+++ b/src/exchangedb/plugin_exchangedb_common.c
@@ -34,13 +34,13 @@ common_free_reserve_history (void *cls,
   struct TALER_EXCHANGEDB_CollectableBlindcoin *cbc;
   struct TALER_EXCHANGEDB_Payback *payback;
   struct TALER_EXCHANGEDB_ReserveHistory *backref;
-
+  struct TALER_EXCHANGEDB_ClosingTransfer *closing;
+    
   while (NULL != rh)
   {
     switch(rh->type)
     {
     case TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE:
-    case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
       bt = rh->details.bank;
       if (NULL != bt->sender_account_details)
         json_decref (bt->sender_account_details);
@@ -60,6 +60,14 @@ common_free_reserve_history (void *cls,
       GNUNET_CRYPTO_rsa_public_key_free 
(payback->coin.denom_pub.rsa_public_key);
       GNUNET_free (payback);
       break;
+    case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
+      closing = rh->details.closing;
+      if (NULL != closing->receiver_account_details)
+        json_decref (closing->receiver_account_details);
+      if (NULL != closing->transfer_details)
+        json_decref (closing->transfer_details);
+      GNUNET_free (closing);
+      break;
     }
     backref = rh;
     rh = rh->next;
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 330380d..83949d8 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -295,6 +295,7 @@ static struct TALER_Amount fee_withdraw;
 static struct TALER_Amount fee_deposit;
 static struct TALER_Amount fee_refresh;
 static struct TALER_Amount fee_refund;
+static struct TALER_Amount fee_closing;
 static struct TALER_Amount amount_with_fee;
 
 
@@ -1611,7 +1612,25 @@ run (void *cls)
                                           &value,
                                           &cbc.h_coin_envelope,
                                           deadline));
-
+  sndr = json_loads ("{ \"account\":\"1\" }", 0, NULL);
+  just = json_loads ("{ \"trans-details\":\"2\" }", 0, NULL);
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_string_to_amount (CURRENCY ":0.000010",
+                                         &fee_closing));
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_string_to_amount (CURRENCY ":1.000010",
+                                         &amount_with_fee));
+  FAILIF (GNUNET_OK !=
+         plugin->insert_reserve_closed (plugin->cls,
+                                        session,
+                                        &reserve_pub,
+                                        GNUNET_TIME_absolute_get (),
+                                        sndr /* receiver_account */,
+                                        just /* transfer_details */,
+                                        &amount_with_fee,
+                                        &fee_closing));
+  json_decref (just);
+  json_decref (sndr);  
   result = 7;
   rh = plugin->get_reserve_history (plugin->cls,
                                     session,
@@ -1664,11 +1683,22 @@ run (void *cls)
       }
       break;
     case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
-      GNUNET_break (0); /* FIXME: #4956 */
+      {
+        struct TALER_EXCHANGEDB_ClosingTransfer *closing
+         = rh_head->details.closing;
+
+        FAILIF (0 != memcmp (&closing->reserve_pub,
+                             &reserve_pub,
+                             sizeof (reserve_pub)));
+        FAILIF (0 != TALER_amount_cmp (&closing->amount,
+                                       &amount_with_fee));
+        FAILIF (0 != TALER_amount_cmp (&closing->closing_fee,
+                                       &fee_closing));
+      }
       break;
     }
   }
-  FAILIF (4 != cnt);
+  FAILIF (5 != cnt);
 
   auditor_row_cnt = 0;
   FAILIF (GNUNET_OK !=

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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