From ca87a98695221ea3b8beb08c40cf04f6afe7bd2c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 28 Oct 2021 20:35:16 +0200 Subject: -work on FTBFS of src/testing --- src/include/taler_merchant_testing_lib.h | 22 +++++++++++ src/testing/testing_api_cmd_abort_order.c | 37 +++++++----------- src/testing/testing_api_cmd_claim_order.c | 27 +++++-------- src/testing/testing_api_cmd_delete_reserve.c | 1 - src/testing/testing_api_cmd_forget_order.c | 16 ++++---- src/testing/testing_api_cmd_get_instance.c | 57 +++++++++++++-------------- src/testing/testing_api_cmd_get_instances.c | 20 +++++----- src/testing/testing_api_cmd_get_orders.c | 7 ++-- src/testing/testing_api_cmd_get_product.c | 58 ++++++++++++++-------------- src/testing/testing_api_cmd_get_products.c | 10 ++--- src/testing/testing_api_cmd_get_reserve.c | 29 +++++++------- src/testing/testing_api_cmd_get_reserves.c | 6 +-- src/testing/testing_api_cmd_get_tips.c | 6 +-- src/testing/testing_api_cmd_get_transfers.c | 36 ++++++++--------- src/testing/testing_api_cmd_instance_auth.c | 5 +-- src/testing/testing_api_cmd_lock_product.c | 6 +-- 16 files changed, 163 insertions(+), 180 deletions(-) diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h index c02cf514..94010bb4 100644 --- a/src/include/taler_merchant_testing_lib.h +++ b/src/include/taler_merchant_testing_lib.h @@ -1476,6 +1476,27 @@ TALER_TESTING_cmd_tip_pickup (const char *label, #define TALER_MERCHANT_TESTING_SIMPLE_TRAITS(op) \ op (claim_nonce, const struct GNUNET_CRYPTO_EddsaPublicKey) \ op (tip_id, const struct GNUNET_HashCode) \ + op (instance_name, const char *) \ + op (instance_id, const char *) \ + op (address, const json_t) \ + op (product_description, const char *) \ + op (product_image, const char *) \ + op (product_stock, const int64_t) \ + op (product_unit, const char *) \ + op (product_id, const char *) \ + op (reason, const char *) \ + op (lock_uuid, const char *) \ + op (auth_token, const char *) \ + op (paths_length, uint32_t) \ + op (tip_id, const struct GNUNET_HashCode) \ + op (i18n_description, const json_t) \ + op (taxes, const json_t) \ + op (max_wire_fee, const struct TALER_Amount) \ + op (max_deposit_fee, const struct TALER_Amount) \ + op (wire_fee_amortization, const uint32_t) \ + op (jurisdiction, const json_t *) \ + op (wire_delay, const struct GNUNET_TIME_Relative) \ + op (pay_delay, const struct GNUNET_TIME_Relative) \ op (refund_entry, const struct TALER_MERCHANT_RefundDetail) \ op (h_contract_terms, const struct TALER_PrivateContractHash) \ op (proposal_reference, const char *) @@ -1486,6 +1507,7 @@ TALER_TESTING_cmd_tip_pickup (const char *label, */ #define TALER_MERCHANT_TESTING_INDEXED_TRAITS(op) \ op (coin_reference, const char *) \ + op (paths, const char *) \ op (planchet_secrets, struct TALER_PlanchetSecretsP *) diff --git a/src/testing/testing_api_cmd_abort_order.c b/src/testing/testing_api_cmd_abort_order.c index 966d93ff..d2e2d357 100644 --- a/src/testing/testing_api_cmd_abort_order.c +++ b/src/testing/testing_api_cmd_abort_order.c @@ -28,8 +28,6 @@ #include "taler_merchant_service.h" #include "taler_merchant_testing_lib.h" -#define AMOUNT_WITH_FEE 0 - /** * State for a " abort" CMD. */ @@ -85,19 +83,15 @@ struct AbortState * @param[in] coins string specifying coins to add to @a pc, * clobbered in the process * @param is interpreter state - * @param amount_with_fee total amount to be paid for a contract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue build_coins (struct TALER_MERCHANT_AbortCoin **ac, unsigned int *nac, char *coins, - struct TALER_TESTING_Interpreter *is, - const char *amount_with_fee) + struct TALER_TESTING_Interpreter *is) { - char *token; - - for (token = strtok (coins, ";"); + for (char *token = strtok (coins, ";"); NULL != token; token = strtok (NULL, ";")) { @@ -123,6 +117,8 @@ build_coins (struct TALER_MERCHANT_AbortCoin **ac, // FIXME: ci not used!? { const struct TALER_TESTING_Command *coin_cmd; + const char **exchange_url; + coin_cmd = TALER_TESTING_interpreter_lookup_command (is, token); if (NULL == coin_cmd) @@ -146,9 +142,9 @@ build_coins (struct TALER_MERCHANT_AbortCoin **ac, &icoin->coin_pub.eddsa_pub); } GNUNET_assert (GNUNET_OK == - TALER_TESTING_get_trait_url (coin_cmd, - TALER_TESTING_UT_EXCHANGE_BASE_URL, - &icoin->exchange_url)); + TALER_TESTING_get_trait_exchange_url (coin_cmd, + &exchange_url)); + icoin->exchange_url = *exchange_url; { const struct TALER_Amount *denom_value; @@ -230,9 +226,8 @@ abort_run (void *cls, { struct AbortState *as = cls; const struct TALER_TESTING_Command *pay_cmd; - const char *proposal_reference; - const char *coin_reference; - const char *amount_with_fee; + const char **proposal_reference; + const char **coin_reference; const struct TALER_TESTING_Command *proposal_cmd; const char *order_id; const struct TALER_PrivateContractHash *h_proposal; @@ -258,13 +253,8 @@ abort_run (void *cls, 0, &coin_reference)) TALER_TESTING_FAIL (is); - if (GNUNET_OK != - TALER_TESTING_get_trait_string (pay_cmd, - AMOUNT_WITH_FEE, - &amount_with_fee)) - TALER_TESTING_FAIL (is); proposal_cmd = TALER_TESTING_interpreter_lookup_command (is, - proposal_reference); + *proposal_reference); if (NULL == proposal_cmd) TALER_TESTING_FAIL (is); @@ -310,15 +300,14 @@ abort_run (void *cls, } } - cr = GNUNET_strdup (coin_reference); + cr = GNUNET_strdup (*coin_reference); abort_coins = NULL; nabort_coins = 0; if (GNUNET_OK != build_coins (&abort_coins, &nabort_coins, cr, - is, - amount_with_fee)) + is)) { GNUNET_array_grow (abort_coins, nabort_coins, diff --git a/src/testing/testing_api_cmd_claim_order.c b/src/testing/testing_api_cmd_claim_order.c index 3a692a6f..b2c8c6c5 100644 --- a/src/testing/testing_api_cmd_claim_order.c +++ b/src/testing/testing_api_cmd_claim_order.c @@ -52,7 +52,7 @@ struct OrderClaimState /** * Hash over the contract terms. Only set if we got #MHD_HTTP_OK. */ - struct GNUNET_HashCode contract_terms_hash; + struct TALER_PrivateContractHash contract_terms_hash; /** * Signature of the merchant. Only set if we got #MHD_HTTP_OK. @@ -135,7 +135,7 @@ order_claim_cb (void *cls, const struct TALER_MERCHANT_HttpResponse *hr, const json_t *contract_terms, const struct TALER_MerchantSignatureP *sig, - const struct GNUNET_HashCode *hash) + const struct TALER_PrivateContractHash *hash) { struct OrderClaimState *pls = cls; @@ -185,7 +185,7 @@ order_claim_run (void *cls, struct TALER_TESTING_Interpreter *is) { struct OrderClaimState *pls = cls; - const char *order_id; + const char **order_id; const struct GNUNET_CRYPTO_EddsaPublicKey *nonce; /* Only used if we do NOT use the nonce/token from traits. */ struct GNUNET_CRYPTO_EddsaPublicKey dummy_nonce; @@ -194,7 +194,7 @@ order_claim_run (void *cls, pls->is = is; if (NULL != pls->order_id) { - order_id = pls->order_id; + order_id = &pls->order_id; GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, &dummy_nonce, sizeof (dummy_nonce)); @@ -212,7 +212,6 @@ order_claim_run (void *cls, TALER_TESTING_FAIL (is); if (GNUNET_OK != TALER_TESTING_get_trait_claim_nonce (order_cmd, - 0, &nonce)) { GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, @@ -222,18 +221,16 @@ order_claim_run (void *cls, } if (GNUNET_OK != TALER_TESTING_get_trait_claim_token (order_cmd, - 0, &claim_token)) claim_token = NULL; if (GNUNET_OK != TALER_TESTING_get_trait_order_id (order_cmd, - 0, &order_id)) TALER_TESTING_FAIL (is); } pls->och = TALER_MERCHANT_order_claim (is->ctx, pls->merchant_url, - order_id, + *order_id, nonce, claim_token, &order_claim_cb, @@ -252,7 +249,7 @@ order_claim_run (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue order_claim_traits (void *cls, const void **ret, const char *trait, @@ -260,14 +257,10 @@ order_claim_traits (void *cls, { struct OrderClaimState *pls = cls; struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_contract_terms (0, - pls->contract_terms), - TALER_TESTING_make_trait_h_contract_terms (0, - &pls->contract_terms_hash), - TALER_TESTING_make_trait_merchant_sig (0, - &pls->merchant_sig), - TALER_TESTING_make_trait_merchant_pub (0, - &pls->merchant_pub), + TALER_TESTING_make_trait_contract_terms (pls->contract_terms), + TALER_TESTING_make_trait_h_contract_terms (&pls->contract_terms_hash), + TALER_TESTING_make_trait_merchant_sig (&pls->merchant_sig), + TALER_TESTING_make_trait_merchant_pub (&pls->merchant_pub), TALER_TESTING_trait_end () }; diff --git a/src/testing/testing_api_cmd_delete_reserve.c b/src/testing/testing_api_cmd_delete_reserve.c index d98b688a..65d27fa6 100644 --- a/src/testing/testing_api_cmd_delete_reserve.c +++ b/src/testing/testing_api_cmd_delete_reserve.c @@ -128,7 +128,6 @@ delete_reserve_run (void *cls, drs->reserve_reference); if (GNUNET_OK != TALER_TESTING_get_trait_reserve_pub (reserve_cmd, - 0, &reserve_pub)) TALER_TESTING_FAIL (is); diff --git a/src/testing/testing_api_cmd_forget_order.c b/src/testing/testing_api_cmd_forget_order.c index 31b24bc0..5e6225d4 100644 --- a/src/testing/testing_api_cmd_forget_order.c +++ b/src/testing/testing_api_cmd_forget_order.c @@ -138,12 +138,12 @@ order_forget_run (void *cls, struct TALER_TESTING_Interpreter *is) { struct OrderForgetState *ofs = cls; - const char *order_id; + const char **order_id; ofs->is = is; if (NULL != ofs->order_id) { - order_id = ofs->order_id; + order_id = &ofs->order_id; } else { @@ -156,13 +156,12 @@ order_forget_run (void *cls, TALER_TESTING_FAIL (is); if (GNUNET_OK != TALER_TESTING_get_trait_order_id (order_cmd, - 0, &order_id)) TALER_TESTING_FAIL (is); } ofs->ofh = TALER_MERCHANT_order_forget (is->ctx, ofs->merchant_url, - order_id, + *order_id, ofs->paths_length, ofs->paths, &order_forget_cb, @@ -180,7 +179,7 @@ order_forget_run (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue order_forget_traits (void *cls, const void **ret, const char *trait, @@ -189,11 +188,10 @@ order_forget_traits (void *cls, struct OrderForgetState *ofs = cls; struct TALER_TESTING_Trait traits[ofs->paths_length + 2]; - traits[0] = TALER_TESTING_make_trait_uint32 (0, - &ofs->paths_length); + traits[0] = TALER_TESTING_make_trait_paths_length (&ofs->paths_length); for (unsigned int i = 0; i < ofs->paths_length; ++i) - traits[i + 1] = TALER_TESTING_make_trait_string (i, - ofs->paths[i]); + traits[i + 1] = TALER_TESTING_make_trait_paths (i, + &ofs->paths[i]); traits[ofs->paths_length + 1] = TALER_TESTING_trait_end (); return TALER_TESTING_get_trait (traits, diff --git a/src/testing/testing_api_cmd_get_instance.c b/src/testing/testing_api_cmd_get_instance.c index 0bd736f1..28f34091 100644 --- a/src/testing/testing_api_cmd_get_instance.c +++ b/src/testing/testing_api_cmd_get_instance.c @@ -131,30 +131,29 @@ get_instance_cb (void *cls, { case MHD_HTTP_OK: { - const char *name; + const char **name; if (GNUNET_OK != - TALER_TESTING_get_trait_string (instance_cmd, - 0, - &name)) + TALER_TESTING_get_trait_instance_name (instance_cmd, + &name)) TALER_TESTING_interpreter_fail (gis->is); if (0 != strcmp (details->name, - name)) + *name)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Instance name does not match: Got `%s', wanted `%s'\n", details->name, - name); + *name); TALER_TESTING_interpreter_fail (gis->is); return; } } { - const struct json_t *address; + const json_t *address; + if (GNUNET_OK != - TALER_TESTING_get_trait_json (instance_cmd, - 0, - &address)) + TALER_TESTING_get_trait_address (instance_cmd, + &address)) TALER_TESTING_interpreter_fail (gis->is); if (1 != json_equal (details->address, address)) @@ -166,14 +165,14 @@ get_instance_cb (void *cls, } } { - const struct json_t *jurisdiction; + const struct json_t **jurisdiction; + if (GNUNET_OK != - TALER_TESTING_get_trait_json (instance_cmd, - 1, - &jurisdiction)) + TALER_TESTING_get_trait_jurisdiction (instance_cmd, + &jurisdiction)) TALER_TESTING_interpreter_fail (gis->is); if (1 != json_equal (details->jurisdiction, - jurisdiction)) + *jurisdiction)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Instance jurisdiction does not match\n"); @@ -183,10 +182,10 @@ get_instance_cb (void *cls, } { const struct TALER_Amount *default_max_wire_fee; + if (GNUNET_OK != - TALER_TESTING_get_trait_amount_obj (instance_cmd, - 0, - &default_max_wire_fee)) + TALER_TESTING_get_trait_max_wire_fee (instance_cmd, + &default_max_wire_fee)) TALER_TESTING_interpreter_fail (gis->is); if ((GNUNET_OK != TALER_amount_cmp_currency ( details->default_max_wire_fee, @@ -202,10 +201,11 @@ get_instance_cb (void *cls, } { const uint32_t *default_wire_fee_amortization; + if (GNUNET_OK != - TALER_TESTING_get_trait_uint32 (instance_cmd, - 0, - &default_wire_fee_amortization)) + TALER_TESTING_get_trait_wire_fee_amortization (instance_cmd, + & + default_wire_fee_amortization)) TALER_TESTING_interpreter_fail (gis->is); if (details->default_wire_fee_amortization != *default_wire_fee_amortization) @@ -220,9 +220,8 @@ get_instance_cb (void *cls, const struct TALER_Amount *default_max_deposit_fee; if (GNUNET_OK != - TALER_TESTING_get_trait_amount_obj (instance_cmd, - 1, - &default_max_deposit_fee)) + TALER_TESTING_get_trait_max_deposit_fee (instance_cmd, + &default_max_deposit_fee)) TALER_TESTING_interpreter_fail (gis->is); if ( (GNUNET_OK != TALER_amount_cmp_currency ( @@ -242,9 +241,8 @@ get_instance_cb (void *cls, const struct GNUNET_TIME_Relative *default_wire_transfer_delay; if (GNUNET_OK != - TALER_TESTING_get_trait_relative_time (instance_cmd, - 0, - &default_wire_transfer_delay)) + TALER_TESTING_get_trait_wire_delay (instance_cmd, + &default_wire_transfer_delay)) TALER_TESTING_interpreter_fail (gis->is); if (details->default_wire_transfer_delay.rel_value_us != default_wire_transfer_delay->rel_value_us) @@ -258,9 +256,8 @@ get_instance_cb (void *cls, { const struct GNUNET_TIME_Relative *default_pay_delay; if (GNUNET_OK != - TALER_TESTING_get_trait_relative_time (instance_cmd, - 1, - &default_pay_delay)) + TALER_TESTING_get_trait_pay_delay (instance_cmd, + &default_pay_delay)) TALER_TESTING_interpreter_fail (gis->is); if (details->default_pay_delay.rel_value_us != default_pay_delay->rel_value_us) diff --git a/src/testing/testing_api_cmd_get_instances.c b/src/testing/testing_api_cmd_get_instances.c index 0e3342e6..8aee04b1 100644 --- a/src/testing/testing_api_cmd_get_instances.c +++ b/src/testing/testing_api_cmd_get_instances.c @@ -113,11 +113,11 @@ get_instances_cb (void *cls, gis->instances[i]); { - const char *name; + const char **name; + if (GNUNET_OK != - TALER_TESTING_get_trait_string (instance_cmd, - 0, - &name)) + TALER_TESTING_get_trait_instance_name (instance_cmd, + &name)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not fetch instance name\n"); @@ -125,7 +125,7 @@ get_instances_cb (void *cls, return; } if (0 != strcmp (iis[i].name, - name)) + *name)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Instance name does not match\n"); @@ -135,11 +135,11 @@ get_instances_cb (void *cls, } { - const char *id; + const char **id; + if (GNUNET_OK != - TALER_TESTING_get_trait_string (instance_cmd, - 1, - &id)) + TALER_TESTING_get_trait_instance_id (instance_cmd, + &id)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not fetch instance id\n"); @@ -147,7 +147,7 @@ get_instances_cb (void *cls, return; } if (0 != strcmp (iis[i].id, - id)) + *id)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Instance id does not match\n"); diff --git a/src/testing/testing_api_cmd_get_orders.c b/src/testing/testing_api_cmd_get_orders.c index dbf647c1..8a08f6f8 100644 --- a/src/testing/testing_api_cmd_get_orders.c +++ b/src/testing/testing_api_cmd_get_orders.c @@ -113,10 +113,10 @@ get_orders_cb (void *cls, gos->orders[i]); { - const char *order_id; + const char **order_id; + if (GNUNET_OK != TALER_TESTING_get_trait_order_id (order_cmd, - 0, &order_id)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -125,7 +125,7 @@ get_orders_cb (void *cls, return; } if (0 != strcmp (orders[i].order_id, - order_id)) + *order_id)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Order id does not match\n"); @@ -147,7 +147,6 @@ get_orders_cb (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_contract_terms (order_cmd, - 0, &contract_terms)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, diff --git a/src/testing/testing_api_cmd_get_product.c b/src/testing/testing_api_cmd_get_product.c index d1f844b0..7f46a5f3 100644 --- a/src/testing/testing_api_cmd_get_product.c +++ b/src/testing/testing_api_cmd_get_product.c @@ -124,18 +124,17 @@ get_product_cb (void *cls, { case MHD_HTTP_OK: { - const char *expected_description; + const char **expected_description; product_cmd = TALER_TESTING_interpreter_lookup_command ( gis->is, gis->product_reference); if (GNUNET_OK != - TALER_TESTING_get_trait_string (product_cmd, - 0, - &expected_description)) + TALER_TESTING_get_trait_product_description (product_cmd, + &expected_description)) TALER_TESTING_interpreter_fail (gis->is); if (0 != strcmp (description, - expected_description)) + *expected_description)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Product description does not match\n"); @@ -145,10 +144,10 @@ get_product_cb (void *cls, } { const json_t *expected_description_i18n; + if (GNUNET_OK != - TALER_TESTING_get_trait_json (product_cmd, - 0, - &expected_description_i18n)) + TALER_TESTING_get_trait_i18n_description (product_cmd, + &expected_description_i18n)) TALER_TESTING_interpreter_fail (gis->is); if (1 != json_equal (description_i18n, expected_description_i18n)) @@ -161,10 +160,10 @@ get_product_cb (void *cls, } { const struct TALER_Amount *expected_price; + if (GNUNET_OK != - TALER_TESTING_get_trait_amount_obj (product_cmd, - 0, - &expected_price)) + TALER_TESTING_get_trait_amount (product_cmd, + &expected_price)) TALER_TESTING_interpreter_fail (gis->is); if ((GNUNET_OK != TALER_amount_cmp_currency (price, expected_price)) || @@ -178,15 +177,14 @@ get_product_cb (void *cls, } } { - const char *expected_image; + const char **expected_image; if (GNUNET_OK != - TALER_TESTING_get_trait_string (product_cmd, - 3, - &expected_image)) + TALER_TESTING_get_trait_product_image (product_cmd, + &expected_image)) TALER_TESTING_interpreter_fail (gis->is); if (0 != strcmp (image, - expected_image)) + *expected_image)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Product image does not match\n"); @@ -196,10 +194,10 @@ get_product_cb (void *cls, } { const json_t *expected_taxes; + if (GNUNET_OK != - TALER_TESTING_get_trait_json (product_cmd, - 2, - &expected_taxes)) + TALER_TESTING_get_trait_taxes (product_cmd, + &expected_taxes)) TALER_TESTING_interpreter_fail (gis->is); if (1 != json_equal (taxes, expected_taxes)) @@ -211,14 +209,14 @@ get_product_cb (void *cls, } } { - const char *expected_unit; + const char **expected_unit; + if (GNUNET_OK != - TALER_TESTING_get_trait_string (product_cmd, - 1, - &expected_unit)) + TALER_TESTING_get_trait_product_unit (product_cmd, + &expected_unit)) TALER_TESTING_interpreter_fail (gis->is); if (0 != strcmp (unit, - expected_unit)) + *expected_unit)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Product unit does not match\n"); @@ -228,10 +226,10 @@ get_product_cb (void *cls, } { const json_t *expected_location; + if (GNUNET_OK != - TALER_TESTING_get_trait_json (product_cmd, - 3, - &expected_location)) + TALER_TESTING_get_trait_address (product_cmd, + &expected_location)) TALER_TESTING_interpreter_fail (gis->is); if (1 != json_equal (location, expected_location)) @@ -244,10 +242,10 @@ get_product_cb (void *cls, } { const int64_t *expected_total_stock; + if (GNUNET_OK != - TALER_TESTING_get_trait_int64 (product_cmd, - 0, - &expected_total_stock)) + TALER_TESTING_get_trait_product_stock (product_cmd, + &expected_total_stock)) TALER_TESTING_interpreter_fail (gis->is); if (total_stock != *expected_total_stock) { diff --git a/src/testing/testing_api_cmd_get_products.c b/src/testing/testing_api_cmd_get_products.c index 534ffea5..190bb4c1 100644 --- a/src/testing/testing_api_cmd_get_products.c +++ b/src/testing/testing_api_cmd_get_products.c @@ -113,11 +113,11 @@ get_products_cb (void *cls, gis->products[i]); { - const char *product_id; + const char **product_id; + if (GNUNET_OK != - TALER_TESTING_get_trait_string (product_cmd, - 2, - &product_id)) + TALER_TESTING_get_trait_product_id (product_cmd, + &product_id)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not fetch product id\n"); @@ -125,7 +125,7 @@ get_products_cb (void *cls, return; } if (0 != strcmp (products[i].product_id, - product_id)) + *product_id)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Product id does not match\n"); diff --git a/src/testing/testing_api_cmd_get_reserve.c b/src/testing/testing_api_cmd_get_reserve.c index 539013ab..95d0c3a8 100644 --- a/src/testing/testing_api_cmd_get_reserve.c +++ b/src/testing/testing_api_cmd_get_reserve.c @@ -110,12 +110,12 @@ get_reserve_cb (void *cls, { const struct TALER_Amount *initial_amount; if (GNUNET_OK != - TALER_TESTING_get_trait_amount_obj (reserve_cmd, - 0, - &initial_amount)) + TALER_TESTING_get_trait_amount (reserve_cmd, + &initial_amount)) TALER_TESTING_interpreter_fail (grs->is); - if ((GNUNET_OK != TALER_amount_cmp_currency (&rs->merchant_initial_amount, - initial_amount)) || + if ((GNUNET_OK != + TALER_amount_cmp_currency (&rs->merchant_initial_amount, + initial_amount)) || (0 != TALER_amount_cmp (&rs->merchant_initial_amount, initial_amount))) { @@ -143,7 +143,6 @@ get_reserve_cb (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_tip_id (tip_cmd, - 0, &tip_id)) TALER_TESTING_interpreter_fail (grs->is); @@ -160,13 +159,13 @@ get_reserve_cb (void *cls, const struct TALER_Amount *total_amount; if (GNUNET_OK != - TALER_TESTING_get_trait_amount_obj (tip_cmd, - 0, - &total_amount)) + TALER_TESTING_get_trait_amount (tip_cmd, + &total_amount)) TALER_TESTING_interpreter_fail (grs->is); - if ((GNUNET_OK != TALER_amount_cmp_currency (&tips[i].amount, - total_amount)) || + if ((GNUNET_OK != + TALER_amount_cmp_currency (&tips[i].amount, + total_amount)) || (0 != TALER_amount_cmp (&tips[i].amount, total_amount))) { @@ -177,16 +176,15 @@ get_reserve_cb (void *cls, } } { - const char *reason; + const char **reason; if (GNUNET_OK != - TALER_TESTING_get_trait_string (tip_cmd, - 0, + TALER_TESTING_get_trait_reason (tip_cmd, &reason)) TALER_TESTING_interpreter_fail (grs->is); if (0 != strcmp (tips[i].reason, - reason)) + *reason)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Reserve tip reason does not match\n"); @@ -225,7 +223,6 @@ get_reserve_run (void *cls, grs->reserve_reference); if (GNUNET_OK != TALER_TESTING_get_trait_reserve_pub (reserve_cmd, - 0, &reserve_pub)) TALER_TESTING_FAIL (is); diff --git a/src/testing/testing_api_cmd_get_reserves.c b/src/testing/testing_api_cmd_get_reserves.c index f673d70b..dd0101b7 100644 --- a/src/testing/testing_api_cmd_get_reserves.c +++ b/src/testing/testing_api_cmd_get_reserves.c @@ -114,7 +114,6 @@ get_reserves_cb (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_reserve_pub (reserve_cmd, - 0, &reserve_pub)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -138,9 +137,8 @@ get_reserves_cb (void *cls, const struct TALER_Amount *initial; if (GNUNET_OK != - TALER_TESTING_get_trait_amount_obj (reserve_cmd, - 0, - &initial)) + TALER_TESTING_get_trait_amount (reserve_cmd, + &initial)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not fetch reserve initial balance\n"); diff --git a/src/testing/testing_api_cmd_get_tips.c b/src/testing/testing_api_cmd_get_tips.c index 12b0f56c..9b9a4671 100644 --- a/src/testing/testing_api_cmd_get_tips.c +++ b/src/testing/testing_api_cmd_get_tips.c @@ -125,7 +125,6 @@ get_tips_cb (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_tip_id (tip_cmd, - 0, &tip_id)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -146,9 +145,8 @@ get_tips_cb (void *cls, const struct TALER_Amount *tip_amount; if (GNUNET_OK != - TALER_TESTING_get_trait_amount_obj (tip_cmd, - 0, - &tip_amount)) + TALER_TESTING_get_trait_amount (tip_cmd, + &tip_amount)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not fetch tip amount\n"); diff --git a/src/testing/testing_api_cmd_get_transfers.c b/src/testing/testing_api_cmd_get_transfers.c index e82e6436..5b2907c1 100644 --- a/src/testing/testing_api_cmd_get_transfers.c +++ b/src/testing/testing_api_cmd_get_transfers.c @@ -137,7 +137,6 @@ get_transfers_cb ( if (GNUNET_OK != TALER_TESTING_get_trait_wtid (transfer_cmd, - 0, &wtid)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -158,24 +157,23 @@ get_transfers_cb ( transfers[i].credit_serial); } { - const char *payto_uri; + const char **payto_uri; if (GNUNET_OK != - TALER_TESTING_get_trait_string (transfer_cmd, - 0, - &payto_uri)) + TALER_TESTING_get_trait_payto_uri (transfer_cmd, + &payto_uri)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not fetch wire transfer payto uri\n"); TALER_TESTING_interpreter_fail (gts->is); return; } - if (0 != strcmp (payto_uri, + if (0 != strcmp (*payto_uri, transfers[i].payto_uri)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Wire transfer payto uri does not match: %s != %s\n", - payto_uri, + *payto_uri, transfers[i].payto_uri); TALER_TESTING_interpreter_fail (gts->is); return; @@ -185,20 +183,19 @@ get_transfers_cb ( const struct TALER_Amount *credit_amount; if (GNUNET_OK != - TALER_TESTING_get_trait_amount_obj (transfer_cmd, - 0, - &credit_amount)) + TALER_TESTING_get_trait_amount (transfer_cmd, + &credit_amount)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not fetch wire transfer credit amount\n"); TALER_TESTING_interpreter_fail (gts->is); return; } - if ((GNUNET_OK != TALER_amount_cmp_currency (credit_amount, - &transfers[i].credit_amount)) - || - (0 != TALER_amount_cmp (credit_amount, - &transfers[i].credit_amount))) + if ( (GNUNET_OK != + TALER_amount_cmp_currency (credit_amount, + &transfers[i].credit_amount)) || + (0 != TALER_amount_cmp (credit_amount, + &transfers[i].credit_amount))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Wire transfer credit amount does not match\n"); @@ -207,19 +204,18 @@ get_transfers_cb ( } } { - const char *exchange_url; + const char **exchange_url; if (GNUNET_OK != - TALER_TESTING_get_trait_string (transfer_cmd, - 1, - &exchange_url)) + TALER_TESTING_get_trait_exchange_url (transfer_cmd, + &exchange_url)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not fetch wire transfer exchange url\n"); TALER_TESTING_interpreter_fail (gts->is); return; } - if (0 != strcmp (exchange_url, + if (0 != strcmp (*exchange_url, transfers[i].exchange_url)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, diff --git a/src/testing/testing_api_cmd_instance_auth.c b/src/testing/testing_api_cmd_instance_auth.c index f44b025f..f9597464 100644 --- a/src/testing/testing_api_cmd_instance_auth.c +++ b/src/testing/testing_api_cmd_instance_auth.c @@ -167,16 +167,15 @@ auth_instance_cleanup (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue auth_instance_traits (void *cls, const void **ret, const char *trait, unsigned int index) { struct AuthInstanceState *ais = cls; - struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_string (0, ais->auth_token), + TALER_TESTING_make_trait_auth_token (&ais->auth_token), TALER_TESTING_trait_end () }; diff --git a/src/testing/testing_api_cmd_lock_product.c b/src/testing/testing_api_cmd_lock_product.c index 49f815d6..da9e8832 100644 --- a/src/testing/testing_api_cmd_lock_product.c +++ b/src/testing/testing_api_cmd_lock_product.c @@ -180,16 +180,16 @@ lock_product_cleanup (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue lock_product_traits (void *cls, const void **ret, const char *trait, unsigned int index) { struct LockProductState *lps = cls; - struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_string (0, lps->uuid), + TALER_TESTING_make_trait_lock_uuid ( + (const char **) &lps->uuid), TALER_TESTING_trait_end () }; -- cgit v1.2.3