gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: do test for lock product


From: gnunet
Subject: [taler-merchant] branch master updated: do test for lock product
Date: Tue, 07 Jul 2020 03:32:32 +0200

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

jonathan-buchanan pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 002772c  do test for lock product
002772c is described below

commit 002772c388aaa794c068c9239565c8467f6c65a8
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Mon Jul 6 21:32:26 2020 -0400

    do test for lock product
---
 .gitignore                                 |  2 ++
 src/include/taler_merchant_testing_lib.h   | 22 ++++++++++++++++++++++
 src/testing/test_merchant_api.c            | 14 ++++++++++----
 src/testing/testing_api_cmd_lock_product.c | 19 ++++++-------------
 4 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/.gitignore b/.gitignore
index de2187a..f8fd450 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,6 +28,8 @@ GRTAGS
 GTAGS
 tags
 *.swp
+*.gcno
+*.gcda
 src/backend/taler-merchant-httpd
 src/merchant-tools/taler-merchant-dbinit
 src/testing/test_merchant_api
diff --git a/src/include/taler_merchant_testing_lib.h 
b/src/include/taler_merchant_testing_lib.h
index 7b97815..07d572a 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -397,6 +397,28 @@ TALER_TESTING_cmd_merchant_get_product (const char *label,
                                         const char *product_reference);
 
 
+/**
+ * Define a "LOCK /products/$ID" CMD.
+ *
+ * @param label command label.
+ * @param merchant_url base URL of the merchant serving the
+ *        LOCK /product request.
+ * @param product_id the ID of the product to lock.
+ * @param duration how long the lock should last.
+ * @param quantity how money units to lock.
+ * @param http_status expected HTTP response code.
+ * @return the command.
+ */
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_merchant_lock_product (
+  const char *label,
+  const char *merchant_url,
+  const char *product_id,
+  struct GNUNET_TIME_Relative duration,
+  uint32_t quantity,
+  unsigned int http_status);
+
+
 /**
  * Define a "DELETE product" CMD.
  *
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 02a70f3..d6630a6 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -551,7 +551,7 @@ run (void *cls,
                                             "{\"max_fee\":\"EUR:0.5\",\
         \"order_id\":\"1-unpaid\",\
         \"refund_deadline\":{\"t_ms\":0},\
-        \"pay_deadline\":{\"t_ms\":99999999999},\
+        \"pay_deadline\":{\"t_ms\":\"never\"},\
         \"amount\":\"EUR:5.0\",\
         \"summary\": \"useful product\",\
         \"fulfillment_url\": \"https://example.com/\",\
@@ -810,7 +810,7 @@ run (void *cls,
                                             "{\"max_fee\":\"EUR:0.5\",\
         \"order_id\":\"1-tip\",                           \
         \"refund_deadline\":{\"t_ms\":0},\
-        \"pay_deadline\":{\"t_ms\":99999999999999},\
+        \"pay_deadline\":{\"t_ms\":\"never\"},\
         \"amount\":\"EUR:5.0\",\
         \"summary\": \"useful product\",\
         \"fulfillment_url\": \"https://example.com/\",\
@@ -861,7 +861,7 @@ run (void *cls,
                                             "{\"max_fee\":\"EUR:0.5\",\
         \"order_id\":\"10\",\
         \"refund_deadline\":{\"t_ms\":0},\
-        \"pay_deadline\":{\"t_ms\":99999999999999},\
+        \"pay_deadline\":{\"t_ms\":\"never\"},\
         \"amount\":\"EUR:10.0\",\
         \"summary\": \"merchant-lib testcase\",\
         \"fulfillment_url\": \"https://example.com/\",\
@@ -918,7 +918,7 @@ run (void *cls,
                                             "{\"max_fee\":\"EUR:0.5\",\
         \"order_id\":\"11\",\
         \"refund_deadline\":{\"t_ms\":0},\
-        \"pay_deadline\":{\"t_ms\":99999999999999},\
+        \"pay_deadline\":{\"t_ms\":\"never\"},\
         \"amount\":\"EUR:10.0\",\
         \"summary\": \"merchant-lib testcase\",\
         \"fulfillment_url\": \"https://example.com/\",\
@@ -1100,6 +1100,12 @@ run (void *cls,
                                                merchant_url,
                                                "product-1",
                                                MHD_HTTP_NO_CONTENT),
+    TALER_TESTING_cmd_merchant_lock_product ("lock-product-p2",
+                                             merchant_url,
+                                             "product-2",
+                                             GNUNET_TIME_UNIT_MINUTES,
+                                             2,
+                                             MHD_HTTP_NO_CONTENT),
     TALER_TESTING_cmd_batch ("pay",
                              pay),
     TALER_TESTING_cmd_batch ("double-spending",
diff --git a/src/testing/testing_api_cmd_lock_product.c 
b/src/testing/testing_api_cmd_lock_product.c
index 58140ff..0389e9c 100644
--- a/src/testing/testing_api_cmd_lock_product.c
+++ b/src/testing/testing_api_cmd_lock_product.c
@@ -169,17 +169,9 @@ lock_product_cleanup (void *cls,
  * @param label command label.
  * @param merchant_url base URL of the merchant serving the
  *        LOCK /product request.
- * @param product_id the ID of the product to query
- * @param payto_uris_length length of the @a accounts array
- * @param payto_uris URIs of the bank accounts of the merchant product
- * @param name name of the merchant product
- * @param address physical address of the merchant product
- * @param jurisdiction jurisdiction of the merchant product
- * @param default_max_wire_fee default maximum wire fee merchant is willing to 
fully pay
- * @param default_wire_fee_amortization default amortization factor for excess 
wire fees
- * @param default_max_deposit_fee default maximum deposit fee merchant is 
willing to pay
- * @param default_wire_transfer_delay default wire transfer delay merchant 
will ask for
- * @param default_pay_delay default validity period for offers merchant makes
+ * @param product_id the ID of the product to lock.
+ * @param duration how long the lock should last.
+ * @param quantity how money units to lock.
  * @param http_status expected HTTP response code.
  * @return the command.
  */
@@ -188,7 +180,6 @@ TALER_TESTING_cmd_merchant_lock_product (
   const char *label,
   const char *merchant_url,
   const char *product_id,
-  const struct GNUNET_Uuid *uuid,
   struct GNUNET_TIME_Relative duration,
   uint32_t quantity,
   unsigned int http_status)
@@ -199,7 +190,9 @@ TALER_TESTING_cmd_merchant_lock_product (
   pis->merchant_url = merchant_url;
   pis->product_id = product_id;
   pis->http_status = http_status;
-  pis->uuid = *uuid;
+  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
+                              &pis->uuid,
+                              sizeof (struct GNUNET_Uuid));
   pis->duration = duration;
   pis->quantity = quantity;
 

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