diff options
Diffstat (limited to 'src/testing/testing_api_cmd_set_officer.c')
-rw-r--r-- | src/testing/testing_api_cmd_set_officer.c | 78 |
1 files changed, 52 insertions, 26 deletions
diff --git a/src/testing/testing_api_cmd_set_officer.c b/src/testing/testing_api_cmd_set_officer.c index 0e6de262f..4fbe5e368 100644 --- a/src/testing/testing_api_cmd_set_officer.c +++ b/src/testing/testing_api_cmd_set_officer.c @@ -84,27 +84,22 @@ struct SetOfficerState * if the response code is acceptable. * * @param cls closure. - * @param hr HTTP response details + * @param ar response details */ static void set_officer_cb (void *cls, - const struct TALER_EXCHANGE_HttpResponse *hr) + const struct + TALER_EXCHANGE_ManagementUpdateAmlOfficerResponse *ar) { struct SetOfficerState *ds = cls; + const struct TALER_EXCHANGE_HttpResponse *hr = &ar->hr; 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, + MHD_HTTP_NO_CONTENT); return; } TALER_TESTING_interpreter_next (ds->is); @@ -126,8 +121,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) @@ -159,16 +170,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, @@ -201,10 +229,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; } @@ -232,7 +258,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 () }; |