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_officer.c | 71 ++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 24 deletions(-) (limited to 'src/testing/testing_api_cmd_set_officer.c') diff --git a/src/testing/testing_api_cmd_set_officer.c b/src/testing/testing_api_cmd_set_officer.c index 1c0495f32..f2464c8a9 100644 --- a/src/testing/testing_api_cmd_set_officer.c +++ b/src/testing/testing_api_cmd_set_officer.c @@ -97,16 +97,8 @@ set_officer_cb (void *cls, ds->dh = NULL; if (MHD_HTTP_NO_CONTENT != hr->http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "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); @@ -128,8 +120,24 @@ set_officer_run (void *cls, struct SetOfficerState *ds = cls; struct GNUNET_TIME_Timestamp now; struct TALER_MasterSignatureP master_sig; + 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)); + } now = GNUNET_TIME_timestamp_get (); ds->is = is; if (NULL == ds->ref_cmd) @@ -161,16 +169,33 @@ set_officer_run (void *cls, ds->officer_pub = *officer_pub; ds->officer_priv = *officer_priv; } - TALER_exchange_offline_aml_officer_status_sign (&ds->officer_pub, - ds->name, - now, - ds->is_active, - ds->read_only, - &is->master_priv, - &master_sig); + { + 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_aml_officer_status_sign (&ds->officer_pub, + ds->name, + now, + ds->is_active, + ds->read_only, + master_priv, + &master_sig); + } ds->dh = TALER_EXCHANGE_management_update_aml_officer ( - is->ctx, - is->exchange_url, + TALER_TESTING_interpreter_get_context (is), + exchange_url, &ds->officer_pub, ds->name, now, @@ -203,10 +228,8 @@ set_officer_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_update_aml_officer_cancel (ds->dh); ds->dh = NULL; } @@ -234,7 +257,7 @@ set_officer_traits (void *cls, struct TALER_TESTING_Trait traits[] = { TALER_TESTING_make_trait_officer_pub (&ws->officer_pub), TALER_TESTING_make_trait_officer_priv (&ws->officer_priv), - TALER_TESTING_make_trait_officer_name (&ws->name), + TALER_TESTING_make_trait_officer_name (ws->name), TALER_TESTING_trait_end () }; -- cgit v1.2.3