summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_get_instances.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/testing_api_cmd_get_instances.c')
-rw-r--r--src/testing/testing_api_cmd_get_instances.c125
1 files changed, 65 insertions, 60 deletions
diff --git a/src/testing/testing_api_cmd_get_instances.c b/src/testing/testing_api_cmd_get_instances.c
index 8aee04b1..dbf61fd6 100644
--- a/src/testing/testing_api_cmd_get_instances.c
+++ b/src/testing/testing_api_cmd_get_instances.c
@@ -71,16 +71,13 @@ struct GetInstancesState
* Callback for a GET /instances operation.
*
* @param cls closure for this function
- * @param hr HTTP response
- * @param iis_length how many instances are returned
- * @param iis all the instances details
+ * @param igr response
*/
static void
get_instances_cb (void *cls,
- const struct TALER_MERCHANT_HttpResponse *hr,
- unsigned int iis_length,
- const struct TALER_MERCHANT_InstanceInformation iis[])
+ const struct TALER_MERCHANT_InstancesGetResponse *igr)
{
+ const struct TALER_MERCHANT_HttpResponse *hr = &igr->hr;
struct GetInstancesState *gis = cls;
gis->igh = NULL;
@@ -97,68 +94,75 @@ get_instances_cb (void *cls,
switch (hr->http_status)
{
case MHD_HTTP_OK:
- if (iis_length != gis->instances_length)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Length of instances found does not match\n");
- TALER_TESTING_interpreter_fail (gis->is);
- return;
- }
- for (unsigned int i = 0; i < iis_length; ++i)
- {
- const struct TALER_TESTING_Command *instance_cmd;
-
- instance_cmd = TALER_TESTING_interpreter_lookup_command (
- gis->is,
- gis->instances[i]);
+ unsigned int iis_length
+ = igr->details.ok.iis_length;
+ const struct TALER_MERCHANT_InstanceInformation *iis
+ = igr->details.ok.iis;
+ if (iis_length != gis->instances_length)
{
- const char **name;
-
- if (GNUNET_OK !=
- TALER_TESTING_get_trait_instance_name (instance_cmd,
- &name))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Could not fetch instance name\n");
- TALER_TESTING_interpreter_fail (gis->is);
- return;
- }
- if (0 != strcmp (iis[i].name,
- *name))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Instance name does not match\n");
- TALER_TESTING_interpreter_fail (gis->is);
- return;
- }
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Length of instances found does not match\n");
+ TALER_TESTING_interpreter_fail (gis->is);
+ return;
}
-
+ for (unsigned int i = 0; i < iis_length; ++i)
{
- const char **id;
+ const struct TALER_TESTING_Command *instance_cmd;
+
+ instance_cmd = TALER_TESTING_interpreter_lookup_command (
+ gis->is,
+ gis->instances[i]);
- if (GNUNET_OK !=
- TALER_TESTING_get_trait_instance_id (instance_cmd,
- &id))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Could not fetch instance id\n");
- TALER_TESTING_interpreter_fail (gis->is);
- return;
+ const char *name;
+
+ if (GNUNET_OK !=
+ TALER_TESTING_get_trait_instance_name (instance_cmd,
+ &name))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not fetch instance name\n");
+ TALER_TESTING_interpreter_fail (gis->is);
+ return;
+ }
+ if (0 != strcmp (iis[i].name,
+ name))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Instance name does not match\n");
+ TALER_TESTING_interpreter_fail (gis->is);
+ return;
+ }
}
- if (0 != strcmp (iis[i].id,
- *id))
+
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Instance id does not match\n");
- TALER_TESTING_interpreter_fail (gis->is);
- return;
+ const char *id;
+
+ if (GNUNET_OK !=
+ TALER_TESTING_get_trait_instance_id (instance_cmd,
+ &id))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not fetch instance id\n");
+ TALER_TESTING_interpreter_fail (gis->is);
+ return;
+ }
+ if (0 != strcmp (iis[i].id,
+ id))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Instance id does not match\n");
+ TALER_TESTING_interpreter_fail (gis->is);
+ return;
+ }
}
}
- }
- // FIXME: compare payment_targets
- break;
+ // FIXME: compare payment_targets
+ break;
+ }
default:
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Unhandled HTTP status %u for GET /instances.\n",
@@ -184,10 +188,11 @@ get_instances_run (void *cls,
struct GetInstancesState *gis = cls;
gis->is = is;
- gis->igh = TALER_MERCHANT_instances_get (is->ctx,
- gis->merchant_url,
- &get_instances_cb,
- gis);
+ gis->igh = TALER_MERCHANT_instances_get (
+ TALER_TESTING_interpreter_get_context (is),
+ gis->merchant_url,
+ &get_instances_cb,
+ gis);
GNUNET_assert (NULL != gis->igh);
}