diff options
Diffstat (limited to 'src/backenddb/test_merchantdb.c')
-rw-r--r-- | src/backenddb/test_merchantdb.c | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c index afb1a380..e0ec18d4 100644 --- a/src/backenddb/test_merchantdb.c +++ b/src/backenddb/test_merchantdb.c @@ -1352,10 +1352,16 @@ test_insert_order (const struct InstanceData *instance, const struct OrderData *order, enum GNUNET_DB_QueryStatus expected_result) { + struct GNUNET_HashCode h_post; + + memset (&h_post, + 42, + sizeof (h_post)); TEST_COND_RET_ON_FAIL (expected_result == plugin->insert_order (plugin->cls, instance->instance.id, order->id, + &h_post, order->pay_deadline, &order->claim_token, order->contract), @@ -1377,11 +1383,18 @@ test_lookup_order (const struct InstanceData *instance, { struct TALER_ClaimTokenP ct; json_t *lookup_terms = NULL; + struct GNUNET_HashCode oh; + struct GNUNET_HashCode wh; + + memset (&wh, + 42, + sizeof (wh)); if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != plugin->lookup_order (plugin->cls, instance->instance.id, order->id, &ct, + &oh, &lookup_terms)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -1390,10 +1403,12 @@ test_lookup_order (const struct InstanceData *instance, json_decref (lookup_terms); return 1; } - if ((1 != json_equal (order->contract, - lookup_terms)) || - (0 != GNUNET_memcmp (&order->claim_token, - &ct))) + if ( (1 != json_equal (order->contract, + lookup_terms)) || + (0 != GNUNET_memcmp (&order->claim_token, + &ct)) || + (0 != GNUNET_memcmp (&oh, + &wh)) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Lookup order failed: incorrect order returned\n"); @@ -2002,16 +2017,21 @@ run_test_orders (struct TestOrders_Closure *cls) TEST_RET_ON_FAIL (test_lookup_order (&cls->instance, &cls->orders[0])); /* Make sure it fails correctly for nonexistent orders */ - if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != - plugin->lookup_order (plugin->cls, - cls->instance.instance.id, - cls->orders[1].id, - NULL, - NULL)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Lookup order failed\n"); - return 1; + struct GNUNET_HashCode unused; + + if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS != + plugin->lookup_order (plugin->cls, + cls->instance.instance.id, + cls->orders[1].id, + NULL, + &unused, + NULL)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Lookup order failed\n"); + return 1; + } } /* Test lookups on multiple orders */ TEST_RET_ON_FAIL (test_insert_order (&cls->instance, |