gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated (4b9062c3 -> 11d161bf)


From: gnunet
Subject: [taler-merchant] branch master updated (4b9062c3 -> 11d161bf)
Date: Tue, 03 Jan 2023 13:19:24 +0100

This is an automated email from the git hooks/post-receive script.

priscilla-huang pushed a change to branch master
in repository merchant.

    from 4b9062c3 -fix template issue on insert
     new dbd6edd6 get template - image error
     new 11d161bf test ok for templates and using templates

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ...ler-merchant-httpd_private-patch-templates-ID.c |  8 ++----
 src/lib/merchant_api_get_template.c                |  2 +-
 src/lib/merchant_api_patch_template.c              |  5 ++--
 src/testing/test_merchant_api.c                    | 33 +++++++++++++---------
 src/testing/testing_api_cmd_get_template.c         |  4 ++-
 src/testing/testing_api_cmd_patch_template.c       |  2 +-
 6 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-patch-templates-ID.c 
b/src/backend/taler-merchant-httpd_private-patch-templates-ID.c
index 9494d506..82227799 100644
--- a/src/backend/taler-merchant-httpd_private-patch-templates-ID.c
+++ b/src/backend/taler-merchant-httpd_private-patch-templates-ID.c
@@ -116,10 +116,8 @@ TMH_private_patch_templates_ID (const struct 
TMH_RequestHandler *rh,
       GNUNET_JSON_spec_string ("image",
                                (const char **) &tp.image),
       NULL),
-    GNUNET_JSON_spec_mark_optional (
-      GNUNET_JSON_spec_json ("template_contract",
-                             &tp.template_contract),
-      NULL),
+    GNUNET_JSON_spec_json ("template_contract",
+                           &tp.template_contract),
     GNUNET_JSON_spec_end ()
   };
 
@@ -148,8 +146,6 @@ TMH_private_patch_templates_ID (const struct 
TMH_RequestHandler *rh,
   }
 
 
-  if (NULL == tp.image)
-    tp.image = "";
   if (! TMH_image_data_url_valid (tp.image))
   {
     GNUNET_break_op (0);
diff --git a/src/lib/merchant_api_get_template.c 
b/src/lib/merchant_api_get_template.c
index bced4097..5d2e5961 100644
--- a/src/lib/merchant_api_get_template.c
+++ b/src/lib/merchant_api_get_template.c
@@ -93,7 +93,7 @@ handle_get_template_finished (void *cls,
   case MHD_HTTP_OK:
     {
       const char *template_description;
-      const char *image = NULL;
+      const char *image;
       json_t *template_contract;
       bool rst_ok = true;
       struct GNUNET_JSON_Specification spec[] = {
diff --git a/src/lib/merchant_api_patch_template.c 
b/src/lib/merchant_api_patch_template.c
index da3af08b..0829b222 100644
--- a/src/lib/merchant_api_patch_template.c
+++ b/src/lib/merchant_api_patch_template.c
@@ -172,8 +172,9 @@ TALER_MERCHANT_template_patch (
   req_obj = GNUNET_JSON_PACK (
     GNUNET_JSON_pack_string ("template_description",
                              template_description),
-    GNUNET_JSON_pack_string ("image",
-                             image),
+    GNUNET_JSON_pack_allow_null (
+                                 GNUNET_JSON_pack_string ("image",
+                                                          image)),
     GNUNET_JSON_pack_object_incref ("template_contract",
                                     (json_t *) template_contract));
   tph = GNUNET_new (struct TALER_MERCHANT_TemplatePatchHandle);
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 2f0f882a..633f1ba5 100644
--- a/src/testing/testing_api_cmd_get_template.c
+++ b/src/testing/testing_api_cmd_get_template.c
@@ -133,7 +133,9 @@ get_template_cb (void *cls,
                            *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;
       }
diff --git a/src/testing/testing_api_cmd_patch_template.c 
b/src/testing/testing_api_cmd_patch_template.c
index 68b5cbaa..5c3a1067 100644
--- a/src/testing/testing_api_cmd_patch_template.c
+++ b/src/testing/testing_api_cmd_patch_template.c
@@ -224,7 +224,7 @@ TALER_TESTING_cmd_merchant_patch_template (
   pis->template_id = template_id;
   pis->http_status = http_status;
   pis->template_description = template_description;
-  pis->image = GNUNET_strdup (image);
+  pis->image = (NULL == image) ? NULL : GNUNET_strdup (image);
   pis->template_contract = template_contract; /* ownership taken */
   {
     struct TALER_TESTING_Command cmd = {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]