From 76b5feef912692bda23e2857369181ad877d3dd1 Mon Sep 17 00:00:00 2001 From: Sree Harsha Totakura Date: Tue, 18 Aug 2015 10:56:47 +0200 Subject: mintdb postgres: test insert_refresh_order() --- src/mintdb/test_mintdb.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/mintdb/test_mintdb.c') diff --git a/src/mintdb/test_mintdb.c b/src/mintdb/test_mintdb.c index 69147b0b7..918576ba7 100644 --- a/src/mintdb/test_mintdb.c +++ b/src/mintdb/test_mintdb.c @@ -185,7 +185,7 @@ test_melting (struct TALER_MINTDB_Session *session) struct TALER_MINTDB_RefreshSession ret_refresh_session; struct GNUNET_HashCode session_hash; struct DenomKeyPair *dkp; - struct DenomKeyPair *new_dkp; + struct DenomKeyPair **new_dkp; /* struct TALER_CoinPublicInfo *coins; */ struct TALER_MINTDB_RefreshMelt *melts; unsigned int cnt; @@ -195,6 +195,7 @@ test_melting (struct TALER_MINTDB_Session *session) RND_BLK (&refresh_session); RND_BLK (&session_hash); melts = NULL; + new_dkp = NULL; /* create and test a refresh session */ refresh_session.num_oldcoins = MELT_OLD_COINS; refresh_session.num_newcoins = 1; @@ -266,6 +267,25 @@ test_melting (struct TALER_MINTDB_Session *session) GNUNET_CRYPTO_rsa_signature_free (ret_melt.coin.denom_sig.rsa_signature); GNUNET_CRYPTO_rsa_public_key_free (ret_melt.coin.denom_pub.rsa_public_key); } + new_dkp = GNUNET_new_array (MELT_NEW_COINS, struct DenomKeyPair *); + struct TALER_DenominationPublicKey *new_denom_pubs; + new_denom_pubs = GNUNET_new_array (MELT_NEW_COINS, + struct TALER_DenominationPublicKey); + for (cnt=0; cnt < MELT_NEW_COINS; cnt++) + { + new_dkp[cnt] = create_denom_key_pair (256, session, + &value, + &fee_withdraw, + &fee_deposit, + &fee_refresh); + new_denom_pubs[cnt]=new_dkp[cnt]->pub; + } + FAILIF (GNUNET_OK != plugin->insert_refresh_order (plugin->cls, + session, + &session_hash, + MELT_NEW_COINS, + new_denom_pubs)); + ret = GNUNET_OK; drop: @@ -276,6 +296,12 @@ test_melting (struct TALER_MINTDB_Session *session) GNUNET_CRYPTO_rsa_signature_free (melts[cnt].coin.denom_sig.rsa_signature); GNUNET_free (melts); } + GNUNET_free_non_null (new_denom_pubs); + for (cnt = 0; + (NULL != new_dkp) && (cnt < MELT_NEW_COINS) && (NULL != new_dkp[cnt]); + cnt++) + destroy_denom_key_pair (new_dkp[cnt]); + GNUNET_free_non_null (new_dkp); return ret; } -- cgit v1.2.3