summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_get_template.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_get_template.c')
-rw-r--r--src/testing/testing_api_cmd_get_template.c59
1 files changed, 27 insertions, 32 deletions
diff --git a/src/testing/testing_api_cmd_get_template.c b/src/testing/testing_api_cmd_get_template.c
index bd9afff3..377ffe44 100644
--- a/src/testing/testing_api_cmd_get_template.c
+++ b/src/testing/testing_api_cmd_get_template.c
@@ -71,37 +71,31 @@ struct GetTemplateState
* Callback for a /get/templates/$ID operation.
*
* @param cls closure for this function
- * @param hr HTTP response details
- * @param template_description description of the template
- * @param image base64-encoded template image
- * @param template_contract where the contract of the company is
+ * @param tgr HTTP response details
*/
static void
get_template_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- const char *template_description,
- const char *image,
- const json_t *template_contract)
+ const struct TALER_MERCHANT_TemplateGetResponse *tgr)
{
struct GetTemplateState *gis = cls;
const struct TALER_TESTING_Command *template_cmd;
gis->igh = NULL;
- if (gis->http_status != hr->http_status)
+ if (gis->http_status != tgr->hr.http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u (%d) to command %s\n",
- hr->http_status,
- (int) hr->ec,
+ tgr->hr.http_status,
+ (int) tgr->hr.ec,
TALER_TESTING_interpreter_get_current_label (gis->is));
TALER_TESTING_interpreter_fail (gis->is);
return;
}
- switch (hr->http_status)
+ switch (tgr->hr.http_status)
{
case MHD_HTTP_OK:
{
- const char **expected_description;
+ const char *expected_description;
template_cmd = TALER_TESTING_interpreter_lookup_command (
gis->is,
@@ -110,8 +104,8 @@ get_template_cb (void *cls,
TALER_TESTING_get_trait_template_description (template_cmd,
&expected_description))
TALER_TESTING_interpreter_fail (gis->is);
- if (0 != strcmp (template_description,
- *expected_description))
+ if (0 != strcmp (tgr->details.ok.template_description,
+ expected_description))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Template description does not match\n");
@@ -120,22 +114,22 @@ get_template_cb (void *cls,
}
}
{
- const char **expected_image;
+ const char *expected_otp_id;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_template_image (template_cmd,
- &expected_image))
+ TALER_TESTING_get_trait_otp_id (template_cmd,
+ &expected_otp_id))
TALER_TESTING_interpreter_fail (gis->is);
- if ( ( (NULL == image) && (NULL != *expected_image)) ||
- ( (NULL != image) && (NULL == *expected_image)) ||
- ( (NULL != image) &&
- (0 != strcmp (image,
- *expected_image)) ) )
+ if ( ( (NULL == tgr->details.ok.otp_id) && (NULL != expected_otp_id)) ||
+ ( (NULL != tgr->details.ok.otp_id) && (NULL == expected_otp_id)) ||
+ ( (NULL != tgr->details.ok.otp_id) &&
+ (0 != strcmp (tgr->details.ok.otp_id,
+ expected_otp_id)) ) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Template image `%s' does not match `%s'\n",
- image,
- *expected_image);
+ "Template pos_key `%s' does not match `%s'\n",
+ tgr->details.ok.otp_id,
+ expected_otp_id);
TALER_TESTING_interpreter_fail (gis->is);
return;
}
@@ -147,7 +141,7 @@ get_template_cb (void *cls,
TALER_TESTING_get_trait_template_contract (template_cmd,
&expected_template_contract))
TALER_TESTING_interpreter_fail (gis->is);
- if (1 != json_equal (template_contract,
+ if (1 != json_equal (tgr->details.ok.template_contract,
expected_template_contract))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -185,11 +179,12 @@ get_template_run (void *cls,
struct GetTemplateState *gis = cls;
gis->is = is;
- gis->igh = TALER_MERCHANT_template_get (is->ctx,
- gis->merchant_url,
- gis->template_id,
- &get_template_cb,
- gis);
+ gis->igh = TALER_MERCHANT_template_get (
+ TALER_TESTING_interpreter_get_context (is),
+ gis->merchant_url,
+ gis->template_id,
+ &get_template_cb,
+ gis);
GNUNET_assert (NULL != gis->igh);
}