gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: Triggering bug in test cases.


From: gnunet
Subject: [taler-merchant] branch master updated: Triggering bug in test cases.
Date: Thu, 16 Jul 2020 18:28:03 +0200

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

ms pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 35c7731  Triggering bug in test cases.
35c7731 is described below

commit 35c77313481a6566bdc10d8633a501c6f3925830
Author: MS <ms@taler.net>
AuthorDate: Thu Jul 16 18:23:09 2020 +0200

    Triggering bug in test cases.
    
    This bug appears when a order gets created, and after
    requested via the GET /private/orders/$ID API.  Instead
    of informing the client about the unpaid status of such
    order, the merchant backend responds with a 404.
---
 src/include/taler_merchant_testing_lib.h  | 24 ++++++++++++-
 src/testing/test_merchant_api.c           | 28 +++++++++++++++
 src/testing/testing_api_cmd_post_orders.c | 60 +++++++++++++++++++++++++++++++
 3 files changed, 111 insertions(+), 1 deletion(-)

diff --git a/src/include/taler_merchant_testing_lib.h 
b/src/include/taler_merchant_testing_lib.h
index 41acf8b..c5ca390 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -491,7 +491,29 @@ TALER_TESTING_cmd_merchant_post_orders (const char *label,
                                         pay_deadline,
                                         const char *amount);
 
-
+/**
+ * Make the "proposal" command AVOIDING claiming the order.
+ *
+ * @param label command label
+ * @param merchant_url base URL of the merchant serving
+ *        the proposal request.
+ * @param http_status expected HTTP status.
+ * @param order_id the name of the order to add.
+ * @param refund_deadline the deadline for refunds on this order.
+ * @param pay_deadline the deadline for payment on this order.
+ * @param amount the amount this order is for.
+ * @return the command
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_post_orders_no_claim (const char *label,
+                                                 const char *merchant_url,
+                                                 unsigned int http_status,
+                                                 const char *order_id,
+                                                 struct GNUNET_TIME_Absolute
+                                                 refund_deadline,
+                                                 struct GNUNET_TIME_Absolute
+                                                 pay_deadline,
+                                                 const char *amount);
 /**
  * Make the "proposal" command.
  *
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 2b2eedd..2d9e926 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -166,6 +166,32 @@ run (void *cls,
     "post-transfer-1",
     NULL
   };
+
+  struct TALER_TESTING_Command get_private_order_id[] = {
+
+    TALER_TESTING_cmd_merchant_post_instances ("instance-create-default",
+                                               merchant_url,
+                                               "default",
+                                               PAYTO_I1,
+                                               "EUR",
+                                               MHD_HTTP_NO_CONTENT),
+
+    TALER_TESTING_cmd_merchant_post_orders_no_claim ("create-proposal-4",
+                                                     merchant_url,
+                                                     MHD_HTTP_OK,
+                                                     "1",
+                                                     GNUNET_TIME_UNIT_ZERO_ABS,
+                                                     
GNUNET_TIME_UNIT_FOREVER_ABS,
+                                                     "EUR:5.0"),
+    TALER_TESTING_cmd_merchant_get_order ("get-order-4",
+                                          merchant_url,
+                                          "create-proposal-4",
+                                          false,
+                                          false,
+                                          MHD_HTTP_OK),
+    TALER_TESTING_cmd_end ()
+  };
+
   struct TALER_TESTING_Command pay[] = {
     /**
      * Move money to the exchange's bank account.
@@ -945,6 +971,8 @@ run (void *cls,
                                             inactivation. */
   };
   struct TALER_TESTING_Command commands[] = {
+    TALER_TESTING_cmd_batch ("orders-id",
+                             get_private_order_id),
     TALER_TESTING_cmd_config ("config",
                               merchant_url,
                               MHD_HTTP_OK),
diff --git a/src/testing/testing_api_cmd_post_orders.c 
b/src/testing/testing_api_cmd_post_orders.c
index 3a48902..8ae0bab 100644
--- a/src/testing/testing_api_cmd_post_orders.c
+++ b/src/testing/testing_api_cmd_post_orders.c
@@ -111,9 +111,15 @@ struct OrdersState
    * The locks that the order should release.
    */
   const char *locks;
+
+  /**
+   * Should the command also CLAIM the order?
+   */
+  bool with_claim;
 };
 
 
+
 /**
  * Offer internal data to other commands.
  *
@@ -264,6 +270,11 @@ order_cb (void *cls,
     return;
   }
 
+  if (false == ps->with_claim)
+  {
+    TALER_TESTING_interpreter_next (ps->is);
+    return;
+  }
   if (NULL ==
       (ps->och = TALER_MERCHANT_order_claim (ps->is->ctx,
                                              ps->merchant_url,
@@ -567,6 +578,54 @@ make_order_json (const char *order_id,
                    amount);
 }
 
+/**
+ * Make the "proposal" command AVOIDING claiming the order.
+ *
+ * @param label command label
+ * @param merchant_url base URL of the merchant serving
+ *        the proposal request.
+ * @param http_status expected HTTP status.
+ * @param order_id the name of the order to add.
+ * @param refund_deadline the deadline for refunds on this order.
+ * @param pay_deadline the deadline for payment on this order.
+ * @param amount the amount this order is for.
+ * @return the command
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_post_orders_no_claim (const char *label,
+                                                 const char *merchant_url,
+                                                 unsigned int http_status,
+                                                 const char *order_id,
+                                                 struct GNUNET_TIME_Absolute
+                                                 refund_deadline,
+                                                 struct GNUNET_TIME_Absolute
+                                                 pay_deadline,
+                                                 const char *amount)
+{
+  struct OrdersState *ps;
+
+  ps = GNUNET_new (struct OrdersState);
+  make_order_json (order_id,
+                   refund_deadline,
+                   pay_deadline,
+                   amount,
+                   &ps->order);
+  ps->http_status = http_status;
+  ps->merchant_url = merchant_url;
+  ps->with_claim = false;
+  {
+    struct TALER_TESTING_Command cmd = {
+      .cls = ps,
+      .label = label,
+      .run = &orders_run,
+      .cleanup = &orders_cleanup,
+      .traits = &orders_traits
+    };
+
+    return cmd;
+  }
+}
+
 
 /**
  * Make the "proposal" command.
@@ -602,6 +661,7 @@ TALER_TESTING_cmd_merchant_post_orders (const char *label,
                    &ps->order);
   ps->http_status = http_status;
   ps->merchant_url = merchant_url;
+  ps->with_claim = true;
   {
     struct TALER_TESTING_Command cmd = {
       .cls = ps,

-- 
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]