diff options
author | Sree Harsha Totakura <sreeharsha@totakura.in> | 2015-03-06 01:15:46 +0100 |
---|---|---|
committer | Sree Harsha Totakura <sreeharsha@totakura.in> | 2015-03-06 01:15:46 +0100 |
commit | 3c7168aad2d61d27ce340fb7337ec7f49add75c7 (patch) | |
tree | b2061f84ec61a8df0cdfe0360972f5a73c9e4ecf /src/mint/test_mint_db.c | |
parent | cee173a8e242e3536c1013e92fd1a01912a2a8e8 (diff) |
Added testcase for reserves_in_insert()
Diffstat (limited to 'src/mint/test_mint_db.c')
-rw-r--r-- | src/mint/test_mint_db.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mint/test_mint_db.c b/src/mint/test_mint_db.c index 4fa84eb3..192bc1e0 100644 --- a/src/mint/test_mint_db.c +++ b/src/mint/test_mint_db.c @@ -39,6 +39,10 @@ run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *config) { PGconn *db; + struct GNUNET_CRYPTO_EddsaPublicKey pub; + struct Reserve reserve; + struct GNUNET_TIME_Absolute expiry; + struct TALER_Amount amount; db = NULL; if (GNUNET_OK != TALER_MINT_DB_init ("postgres:///taler")) @@ -56,6 +60,22 @@ run (void *cls, char *const *args, const char *cfgfile, result = 3; goto drop; } + GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, + &pub, sizeof (pub)); + reserve.pub = &pub; + amount.value = 1; + amount.fraction = 1; + strcpy (amount.currency, "EUR"); + expiry = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), + GNUNET_TIME_UNIT_HOURS); + if (GNUNET_OK != TALER_MINT_DB_reserves_in_insert (db, + &reserve, + amount, + expiry)) + { + result = 4; + goto drop; + } result = 0; drop: if (NULL != db) |