summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_purse_merge.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_purse_merge.c')
-rw-r--r--src/testing/testing_api_cmd_purse_merge.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/src/testing/testing_api_cmd_purse_merge.c b/src/testing/testing_api_cmd_purse_merge.c
index 2ab3a2357..8f4f6b3c7 100644
--- a/src/testing/testing_api_cmd_purse_merge.c
+++ b/src/testing/testing_api_cmd_purse_merge.c
@@ -177,16 +177,8 @@ merge_cb (void *cls,
if (ds->expected_response_code != dr->hr.http_status)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u to command %s in %s:%u\n",
- dr->hr.http_status,
- ds->is->commands[ds->is->ip].label,
- __FILE__,
- __LINE__);
- json_dumpf (dr->hr.reply,
- stderr,
- 0);
- TALER_TESTING_interpreter_fail (ds->is);
+ TALER_TESTING_unexpected_status (ds->is,
+ dr->hr.http_status);
return;
}
TALER_TESTING_interpreter_next (ds->is);
@@ -209,8 +201,12 @@ merge_run (void *cls,
const struct TALER_PurseMergePrivateKeyP *merge_priv;
const json_t *ct;
const struct TALER_TESTING_Command *ref;
+ struct TALER_EXCHANGE_Handle *exchange
+ = TALER_TESTING_get_exchange (is);
(void) cmd;
+ if (NULL == exchange)
+ return;
ds->is = is;
ref = TALER_TESTING_interpreter_lookup_command (ds->is,
ds->merge_ref);
@@ -302,8 +298,21 @@ merge_run (void *cls,
&ds->reserve_pub.eddsa_pub);
{
char *payto_uri;
+ const char *exchange_url;
+ const struct TALER_TESTING_Command *exchange_cmd;
- payto_uri = TALER_reserve_make_payto (is->exchange_url,
+ 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));
+ payto_uri = TALER_reserve_make_payto (exchange_url,
&ds->reserve_pub);
TALER_payto_hash (payto_uri,
&ds->h_payto);
@@ -313,7 +322,7 @@ merge_run (void *cls,
&ds->merge_pub.eddsa_pub);
ds->merge_timestamp = GNUNET_TIME_timestamp_get ();
ds->dh = TALER_EXCHANGE_account_merge (
- is->exchange,
+ exchange,
NULL, /* no wad */
&ds->reserve_priv,
&ds->purse_pub,
@@ -351,10 +360,8 @@ merge_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_account_merge_cancel (ds->dh);
ds->dh = NULL;
}