diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-10-05 23:32:32 +0200 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-10-05 23:32:32 +0200 |
commit | 61cc8f9d3608ca7af2e5f7baedf8ee367bd77b0a (patch) | |
tree | bf06bcc802d11ae0b239752556461afcab5f83c4 | |
parent | d9953edb7156a373f21da0795659cfa5e43a3ed1 (diff) |
resolve #4689
-rw-r--r-- | src/backend/taler-merchant-httpd_pay.c | 3 | ||||
-rw-r--r-- | src/lib/merchant_api_history.c | 4 | ||||
-rw-r--r-- | src/lib/test_merchant_api.c | 36 |
3 files changed, 18 insertions, 25 deletions
diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c index 00c8dfd6..8957d7e4 100644 --- a/src/backend/taler-merchant-httpd_pay.c +++ b/src/backend/taler-merchant-httpd_pay.c @@ -420,9 +420,6 @@ deposit_cb (void *cls, TMH_RESPONSE_make_json_pack ("{s:s}", "merchant_sig", json_string_value (GNUNET_JSON_from_data_auto (&sig)))); - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "responding with: %s\n", - json_string_value (GNUNET_JSON_from_data_auto (&sig))); } diff --git a/src/lib/merchant_api_history.c b/src/lib/merchant_api_history.c index d03535a9..8cce49ed 100644 --- a/src/lib/merchant_api_history.c +++ b/src/lib/merchant_api_history.c @@ -104,6 +104,7 @@ history_raw_cb (void *cls, ho->cb (ho->cb_cls, response_code, json); + return; break; case MHD_HTTP_INTERNAL_SERVER_ERROR: GNUNET_log (GNUNET_ERROR_TYPE_INFO, "history URI not found\n"); @@ -125,7 +126,6 @@ history_raw_cb (void *cls, response_code, json); TALER_MERCHANT_history_cancel (ho); - } /** @@ -155,7 +155,7 @@ TALER_MERCHANT_history (struct GNUNET_CURL_Context *ctx, ho->cb_cls = history_cb_cls; seconds = date.abs_value_us / 1000LL / 1000LL; GNUNET_asprintf (&ho->url, - "%s?date=%llu", + "%s/history?date=%llu", backend_uri, seconds); eh = curl_easy_init (); diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c index e5a9a666..fb39097f 100644 --- a/src/lib/test_merchant_api.c +++ b/src/lib/test_merchant_api.c @@ -31,11 +31,6 @@ #include <microhttpd.h> /** - * Shortcut - */ -#define LOG_INFO(...) GNUNET_log(GNUNET_ERROR_TYPE_INFO, __VA_ARGS__) - -/** * URI under which the merchant is reachable during the testcase. */ #define MERCHANT_URI "http://localhost:8082" @@ -755,14 +750,24 @@ history_cb (void *cls, const json_t *json) { struct InterpreterState *is = cls; + struct Command *cmd = &is->commands[is->ip]; + unsigned int nelements; if (MHD_HTTP_OK != http_status) { fail (is); return; } - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Got 200 OK from /history!\n"); + nelements = json_array_size (json); + if (nelements != (cmd->details.history.nresult * (receiver_idx + 1))) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Did not get as many history entries as expected\n"); + fail (is); + return; + } + next_command (is); } /** @@ -1086,10 +1091,6 @@ pay_cb (void *cls, (jsig = json_object_get (obj, "merchant_sig"))); mr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_PAYMENT_OK); mr.purpose.size = htonl (sizeof (mr)); - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Got DP: %s\n", - json_dumps (obj, - JSON_INDENT (2))); GNUNET_assert (GNUNET_OK == GNUNET_STRINGS_string_to_data (json_string_value (jsig), strlen (json_string_value (jsig)), @@ -1438,8 +1439,8 @@ interpreter_run (void *cls) is->ip = 0; receiver_idx++; receiver = instances[receiver_idx]; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Switching instance: '%s'", + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Switching instance: '%s'\n", receiver); get_new_contracts(is->commands); is->task = GNUNET_SCHEDULER_add_now (interpreter_run, @@ -1773,6 +1774,7 @@ interpreter_run (void *cls) NULL, NULL, NULL, "taler-exchange-aggregator", "taler-exchange-aggregator", + "-l", "/tmp/a/log", "-c", "test_merchant_api.conf", "-t", /* exit when done */ NULL); @@ -1856,9 +1858,6 @@ interpreter_run (void *cls) return; case OC_HISTORY: - LOG_INFO("Processing history\n"); - return; - if (NULL == (cmd->details.history.ho = TALER_MERCHANT_history (ctx, MERCHANT_URI, @@ -2317,8 +2316,7 @@ run (void *cls) }, /** * NOTE: could NOT initialize timestamps by calling GNUNET_TIME_xy () - * because that used to give a 'Initializer element is not constant' - * error at compile time. + * because that raised a 'Initializer element is not constant' when compiling. */ { .oc = OC_HISTORY, .label = "history-1", @@ -2329,7 +2327,7 @@ run (void *cls) { .oc = OC_HISTORY, .label = "history-2", .expected_response_code = MHD_HTTP_OK, - .details.history.date.abs_value_us = 2000000000 * 1000LL *1000LL, + .details.history.date.abs_value_us = 43 * 1000LL * 1000LL, .details.history.nresult = 0 }, /* end of testcase */ @@ -2555,5 +2553,3 @@ main (int argc, return 77; return (GNUNET_OK == result) ? 0 : 1; } - -/* end of test_merchant_api.c */ |