From 1701d4f86a39edc390f172da6f8e72c94b6a8e97 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 7 Jun 2023 23:11:35 +0200 Subject: major libtalertesting API refactoring, including no longer having taler-specific logic in the test engine core --- src/testing/testing_api_cmd_truth_solve.c | 58 +++++++++++++------------------ 1 file changed, 25 insertions(+), 33 deletions(-) (limited to 'src/testing/testing_api_cmd_truth_solve.c') diff --git a/src/testing/testing_api_cmd_truth_solve.c b/src/testing/testing_api_cmd_truth_solve.c index 5c12b3f..1a935eb 100644 --- a/src/testing/testing_api_cmd_truth_solve.c +++ b/src/testing/testing_api_cmd_truth_solve.c @@ -127,14 +127,8 @@ truth_solve_cb (void *cls, ksls->tso = NULL; if (tsr->http_status != ksls->expected_http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u to command %s in %s:%u\n", - tsr->http_status, - ksls->is->commands[ksls->is->ip].label, - __FILE__, - __LINE__); - TALER_TESTING_interpreter_fail (ksls->is); - return; + TALER_TESTING_unexpected_status (ksls->is, + tsr->http_status); } switch (tsr->http_status) { @@ -163,7 +157,7 @@ truth_solve_run (void *cls, const struct ANASTASIS_CRYPTO_TruthKeyP *truth_key; const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid; const struct ANASTASIS_PaymentSecretP *payment_secret; - const char **answerp; + const char *answer; ksls->is = is; if (NULL == ksls->upload_reference) @@ -185,7 +179,7 @@ truth_solve_run (void *cls, return; } { - const char **fn; + const char *fn; if (GNUNET_OK != ANASTASIS_TESTING_get_trait_filename (upload_cmd, @@ -195,8 +189,8 @@ truth_solve_run (void *cls, TALER_TESTING_interpreter_fail (ksls->is); return; } - if (NULL != *fn) - ksls->filename = GNUNET_strdup (*fn); + if (NULL != fn) + ksls->filename = GNUNET_strdup (fn); } if (GNUNET_OK != ANASTASIS_TESTING_get_trait_truth_uuid (upload_cmd, @@ -242,13 +236,13 @@ truth_solve_run (void *cls, } if (GNUNET_OK != ANASTASIS_TESTING_get_trait_code (download_cmd, - &answerp)) + &answer)) { GNUNET_break (0); TALER_TESTING_interpreter_fail (ksls->is); return; } - if (NULL == *answerp) + if (NULL == answer) { GNUNET_break (0); TALER_TESTING_interpreter_fail (ksls->is); @@ -258,9 +252,9 @@ truth_solve_run (void *cls, else { /* answer is the answer */ - answerp = &ksls->answer; + answer = ksls->answer; } - if (NULL == answerp) + if (NULL == answer) { GNUNET_break (0); TALER_TESTING_interpreter_fail (ksls->is); @@ -291,18 +285,19 @@ truth_solve_run (void *cls, { struct GNUNET_HashCode h_answer; - GNUNET_CRYPTO_hash (*answerp, - strlen (*answerp), + GNUNET_CRYPTO_hash (answer, + strlen (answer), &h_answer); - ksls->tso = ANASTASIS_truth_solve (is->ctx, - ksls->anastasis_url, - truth_uuid, - truth_key, - payment_secret, - GNUNET_TIME_UNIT_ZERO, - &h_answer, - &truth_solve_cb, - ksls); + ksls->tso = ANASTASIS_truth_solve ( + TALER_TESTING_interpreter_get_context (is), + ksls->anastasis_url, + truth_uuid, + truth_key, + payment_secret, + GNUNET_TIME_UNIT_ZERO, + &h_answer, + &truth_solve_cb, + ksls); } if (NULL == ksls->tso) { @@ -356,12 +351,9 @@ truth_solve_traits (void *cls, struct TALER_TESTING_Trait traits[] = { ANASTASIS_TESTING_make_trait_payment_secret ( &ksls->payment_secret_response), - TALER_TESTING_make_trait_payto_uri ( - (const char **) ksls->pay_uri), - TALER_TESTING_make_trait_order_id ( - (const char **) &ksls->order_id), - ANASTASIS_TESTING_make_trait_code ( - (const char **) &ksls->code), + TALER_TESTING_make_trait_payto_uri (ksls->pay_uri), + TALER_TESTING_make_trait_order_id (ksls->order_id), + ANASTASIS_TESTING_make_trait_code (ksls->code), TALER_TESTING_trait_end () }; -- cgit v1.2.3