diff options
Diffstat (limited to 'src/testing/testing_api_cmd_get_template.c')
-rw-r--r-- | src/testing/testing_api_cmd_get_template.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/testing/testing_api_cmd_get_template.c b/src/testing/testing_api_cmd_get_template.c index 4e5580da..2f0f882a 100644 --- a/src/testing/testing_api_cmd_get_template.c +++ b/src/testing/testing_api_cmd_get_template.c @@ -78,10 +78,10 @@ struct GetTemplateState */ 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_HttpResponse *hr, + const char *template_description, + const char *image, + const json_t *template_contract) { struct GetTemplateState *gis = cls; const struct TALER_TESTING_Command *template_cmd; @@ -108,7 +108,7 @@ get_template_cb (void *cls, gis->template_reference); if (GNUNET_OK != TALER_TESTING_get_trait_template_description (template_cmd, - &expected_description)) + &expected_description)) TALER_TESTING_interpreter_fail (gis->is); if (0 != strcmp (template_description, *expected_description)) @@ -124,10 +124,13 @@ get_template_cb (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_template_image (template_cmd, - &expected_image)) + &expected_image)) TALER_TESTING_interpreter_fail (gis->is); - if (0 != strcmp (image, - *expected_image)) + if ( ( (NULL == image) && (NULL != *expected_image)) || + ( (NULL != image) && (NULL == *expected_image)) || + ( (NULL != image) && + (0 != strcmp (image, + *expected_image)) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Template image does not match\n"); @@ -174,17 +177,17 @@ get_template_cb (void *cls, */ static void get_template_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 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->merchant_url, + gis->template_id, + &get_template_cb, + gis); GNUNET_assert (NULL != gis->igh); } @@ -198,7 +201,7 @@ get_template_run (void *cls, */ static void get_template_cleanup (void *cls, - const struct TALER_TESTING_Command *cmd) + const struct TALER_TESTING_Command *cmd) { struct GetTemplateState *gis = cls; @@ -214,10 +217,10 @@ get_template_cleanup (void *cls, struct TALER_TESTING_Command TALER_TESTING_cmd_merchant_get_template (const char *label, - const char *merchant_url, - const char *template_id, - unsigned int http_status, - const char *template_reference) + const char *merchant_url, + const char *template_id, + unsigned int http_status, + const char *template_reference) { struct GetTemplateState *gis; |