summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_get_templates.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_get_templates.c')
-rw-r--r--src/testing/testing_api_cmd_get_templates.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/src/testing/testing_api_cmd_get_templates.c b/src/testing/testing_api_cmd_get_templates.c
index 3e9d59c6..bc971dc2 100644
--- a/src/testing/testing_api_cmd_get_templates.c
+++ b/src/testing/testing_api_cmd_get_templates.c
@@ -71,33 +71,29 @@ struct GetTemplatesState
* Callback for a GET /templates operation.
*
* @param cls closure for this function
- * @param hr HTTP response details
- * @param templates_length length of the @a templates array
- * @param templates array of templates the requested instance offers
+ * @param tgr response details
*/
static void
get_templates_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- unsigned int templates_length,
- const struct TALER_MERCHANT_TemplateEntry templates[])
+ const struct TALER_MERCHANT_TemplatesGetResponse *tgr)
{
struct GetTemplatesState *gis = cls;
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:
- if (templates_length != gis->templates_length)
+ if (tgr->details.ok.templates_length != gis->templates_length)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Length of templates found does not match\n");
@@ -113,19 +109,19 @@ get_templates_cb (void *cls,
gis->templates[i]);
{
- const char **template_id;
+ const char *template_id;
if (GNUNET_OK !=
TALER_TESTING_get_trait_template_id (template_cmd,
- &template_id))
+ &template_id))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not fetch template id\n");
TALER_TESTING_interpreter_fail (gis->is);
return;
}
- if (0 != strcmp (templates[i].template_id,
- *template_id))
+ if (0 != strcmp (tgr->details.ok.templates[i].template_id,
+ template_id))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Template id does not match\n");
@@ -143,8 +139,9 @@ get_templates_cb (void *cls,
default:
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Unhandled HTTP status %u (%d).\n",
- hr->http_status,
- hr->ec);
+ tgr->hr.http_status,
+ tgr->hr.ec);
+ break;
}
TALER_TESTING_interpreter_next (gis->is);
}
@@ -160,16 +157,17 @@ get_templates_cb (void *cls,
*/
static void
get_templates_run (void *cls,
- const struct TALER_TESTING_Command *cmd,
- struct TALER_TESTING_Interpreter *is)
+ const struct TALER_TESTING_Command *cmd,
+ struct TALER_TESTING_Interpreter *is)
{
struct GetTemplatesState *gis = cls;
gis->is = is;
- gis->igh = TALER_MERCHANT_templates_get (is->ctx,
- gis->merchant_url,
- &get_templates_cb,
- gis);
+ gis->igh = TALER_MERCHANT_templates_get (
+ TALER_TESTING_interpreter_get_context (is),
+ gis->merchant_url,
+ &get_templates_cb,
+ gis);
GNUNET_assert (NULL != gis->igh);
}
@@ -183,7 +181,7 @@ get_templates_run (void *cls,
*/
static void
get_templates_cleanup (void *cls,
- const struct TALER_TESTING_Command *cmd)
+ const struct TALER_TESTING_Command *cmd)
{
struct GetTemplatesState *gis = cls;
@@ -202,9 +200,9 @@ get_templates_cleanup (void *cls,
struct TALER_TESTING_Command
TALER_TESTING_cmd_merchant_get_templates (const char *label,
- const char *merchant_url,
- unsigned int http_status,
- ...)
+ const char *merchant_url,
+ unsigned int http_status,
+ ...)
{
struct GetTemplatesState *gis;