From a2dde02b64a8ee75c9243632eb45a6ceb9b62dd5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 7 Jun 2023 23:11:05 +0200 Subject: major libtalertesting API refactoring, including no longer having taler-specific logic in the test engine core --- src/testing/testing_api_cmd_set_wire_fee.c | 54 ++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 17 deletions(-) (limited to 'src/testing/testing_api_cmd_set_wire_fee.c') diff --git a/src/testing/testing_api_cmd_set_wire_fee.c b/src/testing/testing_api_cmd_set_wire_fee.c index f0f76a874..b2002e0f8 100644 --- a/src/testing/testing_api_cmd_set_wire_fee.c +++ b/src/testing/testing_api_cmd_set_wire_fee.c @@ -89,16 +89,8 @@ wire_add_cb (void *cls, ds->dh = NULL; if (ds->expected_response_code != hr->http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u to command %s in %s:%u\n", - hr->http_status, - ds->is->commands[ds->is->ip].label, - __FILE__, - __LINE__); - json_dumpf (hr->reply, - stderr, - 0); - TALER_TESTING_interpreter_fail (ds->is); + TALER_TESTING_unexpected_status (ds->is, + hr->http_status); return; } TALER_TESTING_interpreter_next (ds->is); @@ -123,8 +115,24 @@ wire_add_run (void *cls, struct GNUNET_TIME_Timestamp start_time; struct GNUNET_TIME_Timestamp end_time; struct TALER_WireFeeSet fees; + const char *exchange_url; (void) cmd; + { + const struct TALER_TESTING_Command *exchange_cmd; + + exchange_cmd = TALER_TESTING_interpreter_get_command (is, + "exchange"); + if (NULL == exchange_cmd) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } + GNUNET_assert (GNUNET_OK == + TALER_TESTING_get_trait_exchange_url (exchange_cmd, + &exchange_url)); + } ds->is = is; now = GNUNET_TIME_absolute_get (); start_time = GNUNET_TIME_absolute_to_timestamp ( @@ -153,16 +161,30 @@ wire_add_run (void *cls, } else { + const struct TALER_TESTING_Command *exchange_cmd; + const struct TALER_MasterPrivateKeyP *master_priv; + + exchange_cmd = TALER_TESTING_interpreter_get_command (is, + "exchange"); + if (NULL == exchange_cmd) + { + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; + } + GNUNET_assert (GNUNET_OK == + TALER_TESTING_get_trait_master_priv (exchange_cmd, + &master_priv)); TALER_exchange_offline_wire_fee_sign (ds->wire_method, start_time, end_time, &fees, - &is->master_priv, + master_priv, &master_sig); } ds->dh = TALER_EXCHANGE_management_set_wire_fees ( - is->ctx, - is->exchange_url, + TALER_TESTING_interpreter_get_context (is), + exchange_url, ds->wire_method, start_time, end_time, @@ -194,10 +216,8 @@ wire_add_cleanup (void *cls, if (NULL != ds->dh) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Command %u (%s) did not complete\n", - ds->is->ip, - cmd->label); + TALER_TESTING_command_incomplete (ds->is, + cmd->label); TALER_EXCHANGE_management_set_wire_fees_cancel (ds->dh); ds->dh = NULL; } -- cgit v1.2.3