diff options
author | Sree Harsha Totakura <sreeharsha@totakura.in> | 2015-04-12 17:16:21 +0200 |
---|---|---|
committer | Sree Harsha Totakura <sreeharsha@totakura.in> | 2015-04-12 17:18:30 +0200 |
commit | 7e6a673668a077cd373cfbcb1f06805fbab9cf91 (patch) | |
tree | 20a76f4d2f7c14da364bd9028a285784b2afc613 /src/mintdb | |
parent | bd32fb23d83ecc65f6c2a0a6442813209f88942c (diff) |
mintdb: add testcase for insert_denomination
Diffstat (limited to 'src/mintdb')
-rw-r--r-- | src/mintdb/test_mintdb.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/mintdb/test_mintdb.c b/src/mintdb/test_mintdb.c index 9d9e1efa9..a35809e3e 100644 --- a/src/mintdb/test_mintdb.c +++ b/src/mintdb/test_mintdb.c @@ -104,7 +104,7 @@ create_denom_key_pair (unsigned int size) static void -destroy_denon_key_pair (struct DenomKeyPair *dkp) +destroy_denom_key_pair (struct DenomKeyPair *dkp) { GNUNET_CRYPTO_rsa_public_key_free (dkp->pub.rsa_public_key); GNUNET_CRYPTO_rsa_private_key_free (dkp->priv.rsa_private_key); @@ -212,6 +212,33 @@ run (void *cls, amount.currency, expiry.abs_value_us)); dkp = create_denom_key_pair (1024); + { + struct TALER_MINTDB_DenominationKeyIssueInformation dki; + dki.denom_pub = dkp->pub; + dki.issue.start = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); + dki.issue.expire_withdraw = GNUNET_TIME_absolute_hton + (GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), + GNUNET_TIME_UNIT_HOURS)); + dki.issue.expire_spend = GNUNET_TIME_absolute_hton + (GNUNET_TIME_absolute_add + (GNUNET_TIME_absolute_get (), + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 2))); + dki.issue.expire_legal = GNUNET_TIME_absolute_hton + (GNUNET_TIME_absolute_add + (GNUNET_TIME_absolute_get (), + GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 3))); + dki.issue.value.value = GNUNET_htonll (1); + dki.issue.value.fraction = htonl (100); + (void) strcpy (dki.issue.value.currency, CURRENCY); + dki.issue.fee_withdraw.value = 0; + dki.issue.fee_withdraw.fraction = htonl (100); + (void) strcpy (dki.issue.value.currency, CURRENCY); + dki.issue.fee_refresh = dki.issue.fee_withdraw; + FAILIF (GNUNET_OK != + plugin->insert_denomination (plugin->cls, + session, + &dki)); + } RND_BLK(&h_blind); RND_BLK(&cbc.reserve_sig); cbc.denom_pub = dkp->pub; @@ -361,7 +388,7 @@ run (void *cls, plugin->drop_temporary (plugin->cls, session)); if (NULL != dkp) - destroy_denon_key_pair (dkp); + destroy_denom_key_pair (dkp); if (NULL != cbc.sig.rsa_signature) GNUNET_CRYPTO_rsa_signature_free (cbc.sig.rsa_signature); if (NULL != cbc2.denom_pub.rsa_public_key) |