diff options
author | priscilla <priscilla.huang@efrei.net> | 2023-01-03 07:19:03 -0500 |
---|---|---|
committer | priscilla <priscilla.huang@efrei.net> | 2023-01-03 07:19:03 -0500 |
commit | 11d161bf3e688739407364900dbd6dca6f1dade8 (patch) | |
tree | aff6a1449bc0013a74dd1521583dbab98de399cd /src/testing | |
parent | dbd6edd6617647208e59665bcdbf7ce985a4ed28 (diff) |
test ok for templates and using templates
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_merchant_api.c | 33 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_get_template.c | 6 |
2 files changed, 23 insertions, 16 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c index 591a2c8f..a04bbe57 100644 --- a/src/testing/test_merchant_api.c +++ b/src/testing/test_merchant_api.c @@ -1334,9 +1334,10 @@ run (void *cls, "template-2", "another template", "data:image/jpeg;base64,RAWDATA", - json_pack ("{s:s}", - "summary", - "my new summary"), + GNUNET_JSON_PACK ( + GNUNET_JSON_pack_uint64 ("minimum_age", 0), + GNUNET_JSON_pack_time_rel ("pay_duration", + GNUNET_TIME_UNIT_MINUTES)), MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_merchant_get_template ("get-template-t2", merchant_url, @@ -1354,9 +1355,10 @@ run (void *cls, "template-3", "updated template", "data:image/jpeg;base64,RAWDATA", - json_pack ("{s:s}", - "summary", - "my new summary"), + GNUNET_JSON_PACK ( + GNUNET_JSON_pack_uint64 ("minimum_age", 0), + GNUNET_JSON_pack_time_rel ("pay_duration", + GNUNET_TIME_UNIT_MINUTES)), MHD_HTTP_NOT_FOUND), TALER_TESTING_cmd_merchant_post_templates2 ( "post-templates-t3-amount", @@ -1364,41 +1366,44 @@ run (void *cls, "template-amount", "a different template with an amount", NULL, - json_pack ("{s:s}", - "amount", - "EUR:4"), + GNUNET_JSON_PACK ( + GNUNET_JSON_pack_uint64 ("minimum_age", 0), + GNUNET_JSON_pack_time_rel ("pay_duration", + GNUNET_TIME_UNIT_MINUTES), + GNUNET_JSON_pack_string ("amount", + "EUR:4")), MHD_HTTP_NO_CONTENT), TALER_TESTING_cmd_merchant_post_using_templates ( "using-templates-t1", - "template-1", + "post-templates-t1", merchant_url, "summary-1", "EUR:10", MHD_HTTP_OK), TALER_TESTING_cmd_merchant_post_using_templates ( "using-templates-t1-amount-missing", - "template-1", + "post-templates-t1", merchant_url, "summary-1", NULL, MHD_HTTP_CONFLICT), TALER_TESTING_cmd_merchant_post_using_templates ( "using-templates-t1-summary-missing", - "template-1", + "post-templates-t1", merchant_url, NULL, "EUR:10", MHD_HTTP_CONFLICT), TALER_TESTING_cmd_merchant_post_using_templates ( "using-templates-t1-amount-conflict", - "template-amount", + "post-templates-t3-amount", merchant_url, "summary-1", "EUR:10", MHD_HTTP_CONFLICT), TALER_TESTING_cmd_merchant_post_using_templates ( "using-templates-t1-amount-duplicate", - "template-amount", + "post-templates-t3-amount", merchant_url, "summary-1", "EUR:4", diff --git a/src/testing/testing_api_cmd_get_template.c b/src/testing/testing_api_cmd_get_template.c index 44568b89..633f1ba5 100644 --- a/src/testing/testing_api_cmd_get_template.c +++ b/src/testing/testing_api_cmd_get_template.c @@ -128,12 +128,14 @@ get_template_cb (void *cls, TALER_TESTING_interpreter_fail (gis->is); if ( ( (NULL == image) && (NULL != *expected_image)) || ( (NULL != image) && (NULL == *expected_image)) || - ( (NULL == image) && + ( (NULL != image) && (0 != strcmp (image, *expected_image)) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Template image does not match\n"); + "Template image `%s' does not match `%s'\n", + image, + *expected_image); TALER_TESTING_interpreter_fail (gis->is); return; } |