diff options
Diffstat (limited to 'src/testing/testing_api_cmd_post_templates.c')
-rw-r--r-- | src/testing/testing_api_cmd_post_templates.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/testing/testing_api_cmd_post_templates.c b/src/testing/testing_api_cmd_post_templates.c index 32b8d627..f0b6d713 100644 --- a/src/testing/testing_api_cmd_post_templates.c +++ b/src/testing/testing_api_cmd_post_templates.c @@ -60,9 +60,9 @@ struct PostTemplatesState const char *template_description; /** - * base64-encoded product image + * OTP device ID. */ - char *image; + char *otp_id; /** * Contract of the company @@ -92,12 +92,10 @@ post_templates_cb (void *cls, tis->iph = NULL; if (tis->http_status != hr->http_status) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u (%d) to command %s\n", - hr->http_status, - (int) hr->ec, - TALER_TESTING_interpreter_get_current_label (tis->is)); - TALER_TESTING_interpreter_fail (tis->is); + TALER_TESTING_unexpected_status_with_body (tis->is, + hr->http_status, + tis->http_status, + hr->reply); return; } switch (hr->http_status) @@ -110,6 +108,8 @@ post_templates_cb (void *cls, break; case MHD_HTTP_NOT_FOUND: break; + case MHD_HTTP_CONFLICT: + break; default: GNUNET_break (0); GNUNET_log (GNUNET_ERROR_TYPE_WARNING, @@ -136,14 +136,15 @@ post_templates_run (void *cls, struct PostTemplatesState *tis = cls; tis->is = is; - tis->iph = TALER_MERCHANT_templates_post (is->ctx, - tis->merchant_url, - tis->template_id, - tis->template_description, - tis->image, - tis->template_contract, - &post_templates_cb, - tis); + tis->iph = TALER_MERCHANT_templates_post ( + TALER_TESTING_interpreter_get_context (is), + tis->merchant_url, + tis->template_id, + tis->template_description, + tis->otp_id, + tis->template_contract, + &post_templates_cb, + tis); if (NULL == tis->iph) { GNUNET_break (0); @@ -171,11 +172,10 @@ post_templates_traits (void *cls, { struct PostTemplatesState *pts = cls; struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_template_description (&pts->template_description), - TALER_TESTING_make_trait_template_image ( - (const char **) &pts->image), + TALER_TESTING_make_trait_template_description (pts->template_description), + TALER_TESTING_make_trait_otp_id (pts->otp_id), TALER_TESTING_make_trait_template_contract (pts->template_contract), - TALER_TESTING_make_trait_template_id (&pts->template_id), + TALER_TESTING_make_trait_template_id (pts->template_id), TALER_TESTING_trait_end (), }; @@ -205,7 +205,7 @@ post_templates_cleanup (void *cls, "POST /templates operation did not complete\n"); TALER_MERCHANT_templates_post_cancel (tis->iph); } - GNUNET_free (tis->image); + GNUNET_free (tis->otp_id); json_decref (tis->template_contract); GNUNET_free (tis); } @@ -217,7 +217,7 @@ TALER_TESTING_cmd_merchant_post_templates2 ( const char *merchant_url, const char *template_id, const char *template_description, - const char *image, + const char *otp_id, json_t *template_contract, unsigned int http_status) { @@ -231,7 +231,7 @@ TALER_TESTING_cmd_merchant_post_templates2 ( tis->template_id = template_id; tis->http_status = http_status; tis->template_description = template_description; - tis->image = (NULL == image) ? NULL : GNUNET_strdup (image); + tis->otp_id = (NULL == otp_id) ? NULL : GNUNET_strdup (otp_id); tis->template_contract = template_contract; { struct TALER_TESTING_Command cmd = { |