From 002772c388aaa794c068c9239565c8467f6c65a8 Mon Sep 17 00:00:00 2001 From: Jonathan Buchanan Date: Mon, 6 Jul 2020 21:32:26 -0400 Subject: do test for lock product --- src/testing/test_merchant_api.c | 14 ++++++++++---- src/testing/testing_api_cmd_lock_product.c | 19 ++++++------------- 2 files changed, 16 insertions(+), 17 deletions(-) (limited to 'src/testing') 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; -- cgit v1.2.3