summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-06 21:32:26 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-06 21:32:26 -0400
commit002772c388aaa794c068c9239565c8467f6c65a8 (patch)
treeb19a017773da518f1b7ac1e2fd87c7686a9bd23a /src/testing
parent85a02216d8a1926f2a528e0bae64c76410a6263d (diff)
downloadmerchant-002772c388aaa794c068c9239565c8467f6c65a8.tar.gz
merchant-002772c388aaa794c068c9239565c8467f6c65a8.tar.bz2
merchant-002772c388aaa794c068c9239565c8467f6c65a8.zip
do test for lock product
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/test_merchant_api.c14
-rw-r--r--src/testing/testing_api_cmd_lock_product.c19
2 files changed, 16 insertions, 17 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 02a70f33..d6630a69 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 58140ff1..0389e9c0 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;