diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-06-25 17:48:51 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-06-25 17:48:51 +0200 |
commit | 90cf9243dd806f2c36eea0439b75cb653b0a1b35 (patch) | |
tree | 6d362e1316be5dac096e39bfd68273bf7d3c2f06 /src/backenddb/test_merchantdb.c | |
parent | a046360eac672cc7771507b1a65b189955cf6ebd (diff) | |
download | merchant-90cf9243dd806f2c36eea0439b75cb653b0a1b35.tar.gz merchant-90cf9243dd806f2c36eea0439b75cb653b0a1b35.tar.bz2 merchant-90cf9243dd806f2c36eea0439b75cb653b0a1b35.zip |
convert merchant postgres plugin (in large parts) to latest PQ API as part of #5010-fix
Diffstat (limited to 'src/backenddb/test_merchantdb.c')
-rw-r--r-- | src/backenddb/test_merchantdb.c | 89 |
1 files changed, 52 insertions, 37 deletions
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c index c90691d9..13d78628 100644 --- a/src/backenddb/test_merchantdb.c +++ b/src/backenddb/test_merchantdb.c @@ -182,6 +182,11 @@ static json_t *contract; */ static json_t *contract_terms; +/** + * Mock proposal data, not need to be well-formed + */ +static json_t *contract_terms_future; + /** @@ -433,75 +438,85 @@ run (void *cls) json_string ("backenddb test B"))); contract = json_object (); contract_terms = json_object (); + GNUNET_assert (0 == + json_object_set_new (contract_terms, + "order", + json_string ("1"))); + + contract_terms_future = json_object (); + GNUNET_assert (0 == + json_object_set_new (contract_terms_future, + "order", + json_string ("2"))); TALER_JSON_hash (contract_terms, &h_contract_terms); FAILIF (GNUNET_OK != plugin->insert_contract_terms (plugin->cls, - order_id, - &merchant_pub, - timestamp, - contract_terms)); + order_id, + &merchant_pub, + timestamp, + contract_terms)); json_t *out; FAILIF (GNUNET_OK != plugin->find_contract_terms (plugin->cls, - &out, - order_id, - &merchant_pub)); + &out, + order_id, + &merchant_pub)); FAILIF (GNUNET_OK != plugin->find_contract_terms_history (plugin->cls, - order_id, - &merchant_pub, - pd_cb, - NULL)); + order_id, + &merchant_pub, + &pd_cb, + NULL)); FAILIF (GNUNET_OK != plugin->find_contract_terms_from_hash (plugin->cls, - &out, - &h_contract_terms, - &merchant_pub)); + &out, + &h_contract_terms, + &merchant_pub)); FAILIF (1 != plugin->find_contract_terms_by_date_and_range (plugin->cls, - fake_now, - &merchant_pub, - 2, - 1, - GNUNET_NO, - pd_cb, - NULL)); + fake_now, + &merchant_pub, + 2, + 1, + GNUNET_NO, + &pd_cb, + NULL)); timestamp = GNUNET_TIME_absolute_get (); GNUNET_TIME_round_abs (×tamp); FAILIF (GNUNET_OK != plugin->insert_contract_terms (plugin->cls, - order_id_future, - &merchant_pub, - timestamp, - contract_terms)); + order_id_future, + &merchant_pub, + timestamp, + contract_terms_future)); fake_now = GNUNET_TIME_absolute_subtract (timestamp, delta); FAILIF (2 != plugin->find_contract_terms_by_date_and_range (plugin->cls, - fake_now, - &merchant_pub, - 0, - 5, - GNUNET_YES, - pd_cb, - NULL)); + fake_now, + &merchant_pub, + 0, + 5, + GNUNET_YES, + &pd_cb, + NULL)); FAILIF (0 != plugin->find_contract_terms_by_date (plugin->cls, - fake_now, - &merchant_pub, - 1, - pd_cb, - NULL)); + fake_now, + &merchant_pub, + 1, + &pd_cb, + NULL)); FAILIF (GNUNET_OK != plugin->store_transaction (plugin->cls, |