diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-30 14:17:42 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-30 14:17:42 +0100 |
commit | fae4fb8687587377c01048de574b1d2a0556bf3e (patch) | |
tree | 37835ba6344974e244abf3a23a052e3d43d7d8a4 /src/mint/test_mint_deposits.c | |
parent | c750f53d5af9858e2e62f1176664fbe6e7339de6 (diff) | |
download | exchange-fae4fb8687587377c01048de574b1d2a0556bf3e.tar.gz exchange-fae4fb8687587377c01048de574b1d2a0556bf3e.tar.bz2 exchange-fae4fb8687587377c01048de574b1d2a0556bf3e.zip |
fixing ftbfs of testcase
Diffstat (limited to 'src/mint/test_mint_deposits.c')
-rw-r--r-- | src/mint/test_mint_deposits.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/mint/test_mint_deposits.c b/src/mint/test_mint_deposits.c index 045485b20..c9fd3a756 100644 --- a/src/mint/test_mint_deposits.c +++ b/src/mint/test_mint_deposits.c @@ -24,9 +24,16 @@ #include <libpq-fe.h> #include <gnunet/gnunet_util_lib.h> #include "mint_db.h" +#include "db_pq.h" +#include "taler-mint-httpd.h" #define DB_URI "postgres:///taler" +#define break_db_err(result) do { \ + GNUNET_break(0); \ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Database failure: %s\n", PQresultErrorMessage (result)); \ + } while (0) + /** * Shorthand for exit jumps. */ @@ -118,11 +125,9 @@ run (void *cls, char *const *args, const char *cfgfile, "\"BIC\":\"GENODEF1SRL\"" "}"; struct Deposit *deposit; - struct Deposit *q_deposit; uint64_t transaction_id; deposit = NULL; - q_deposit = NULL; GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_shutdown, NULL); EXITIF (NULL == (conn = PQconnectdb(DB_URI))); @@ -145,24 +150,15 @@ run (void *cls, char *const *args, const char *cfgfile, GNUNET_assert (strlen (MINT_CURRENCY) < sizeof (deposit->amount.currency)); strcpy (deposit->amount.currency, MINT_CURRENCY); /* Copy wireformat */ - memcpy (deposit->wire, - wire, - sizeof (wire)); + deposit->wire = json_loads (wire, 0, NULL); EXITIF (GNUNET_OK != TALER_MINT_DB_insert_deposit (conn, deposit)); - EXITIF (GNUNET_OK != TALER_MINT_DB_get_deposit (conn, - &deposit->coin_pub, - &q_deposit)); - EXITIF (0 != memcmp (deposit, - q_deposit, - sizeof (struct Deposit) - offsetof(struct Deposit, - wire))); - EXITIF (transaction_id != GNUNET_ntohll (q_deposit->transaction_id)); + EXITIF (GNUNET_OK != TALER_MINT_DB_have_deposit (conn, + deposit)); result = GNUNET_OK; EXITIF_exit: GNUNET_free_non_null (deposit); - GNUNET_free_non_null (q_deposit); GNUNET_SCHEDULER_shutdown (); return; } |