expand testcase to cover new DB API
This commit is contained in:
parent
487237381d
commit
92d9ec69e6
@ -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;
|
||||
|
@ -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 !=
|
||||
|
Loading…
Reference in New Issue
Block a user