summaryrefslogtreecommitdiff
path: root/src/exchangedb/test_exchangedb.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-04-20 09:04:20 +0200
committerChristian Grothoff <christian@grothoff.org>2017-04-20 09:04:20 +0200
commit92d9ec69e6d8e9f7eb0be0d6a7f67444189b319e (patch)
treeeb4c2c115b6d1e6561bb81bd16ccd56b93923269 /src/exchangedb/test_exchangedb.c
parent487237381dc81c16878b2e3faaac37777b6dd7bf (diff)
downloadexchange-92d9ec69e6d8e9f7eb0be0d6a7f67444189b319e.tar.gz
exchange-92d9ec69e6d8e9f7eb0be0d6a7f67444189b319e.tar.bz2
exchange-92d9ec69e6d8e9f7eb0be0d6a7f67444189b319e.zip
expand testcase to cover new DB API
Diffstat (limited to 'src/exchangedb/test_exchangedb.c')
-rw-r--r--src/exchangedb/test_exchangedb.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 330380d31..83949d855 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 !=