aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-17 17:53:53 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-17 17:53:53 -0400
commit2fe7aad94305e29d2b6bd4d4870d315e348a5576 (patch)
tree08d23675312707dee3873999d3764aae10ee8e6f
parent13fe41ec6ceca3a2cd0a48ddee3205fe8beb3881 (diff)
fix valgrind error in test_merchant_api
-rw-r--r--src/backend/taler-merchant-httpd_private-post-products-ID-lock.c2
-rw-r--r--src/testing/test_merchant_api.c33
-rw-r--r--src/testing/testing_api_cmd_post_orders.c6
3 files changed, 32 insertions, 9 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c b/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c
index aac8b8c9..d7f87c7f 100644
--- a/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c
+++ b/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c
@@ -100,7 +100,7 @@ TMH_private_post_products_ID_lock (const struct TMH_RequestHandler *rh,
"The specified product is unknown");
else
return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_CONFLICT,
+ MHD_HTTP_GONE,
TALER_EC_PRODUCTS_LOCK_INSUFFICIENT_STOCKS,
"The specified product is out of stock");
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 1a074240..0d4bc471 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -108,6 +108,15 @@ static struct GNUNET_OS_Process *merchantd;
*/
#define MERCHANT_ACCOUNT_NAME "3"
+/**
+ * Payto URIs to use for testing accounts on the merchant.
+ */
+const char *payto_uris[] = {
+ PAYTO_I1,
+ "payto://sepa/CH9300762011623852957" /* Just for testing account
+ inactivation. */
+};
+
/**
* Execute the taler-exchange-wirewatch command with
@@ -423,6 +432,13 @@ run (void *cls,
merchant_url,
"1",
MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-no-id",
+ merchant_url,
+ MHD_HTTP_OK,
+ NULL,
+ GNUNET_TIME_UNIT_ZERO_ABS,
+ GNUNET_TIME_UNIT_FOREVER_ABS,
+ "EUR:5.0"),
TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-2"),
TALER_TESTING_cmd_end ()
};
@@ -969,11 +985,6 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
- const char *payto_uris[] = {
- PAYTO_I1,
- "payto://sepa/CH9300762011623852957" /* Just for testing account
- inactivation. */
- };
struct TALER_TESTING_Command commands[] = {
TALER_TESTING_cmd_batch ("orders-id",
get_private_order_id),
@@ -1188,6 +1199,18 @@ run (void *cls,
GNUNET_TIME_UNIT_MINUTES,
2,
MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_lock_product ("lock-product-nx",
+ merchant_url,
+ "product-nx",
+ GNUNET_TIME_UNIT_MINUTES,
+ 2,
+ MHD_HTTP_NOT_FOUND),
+ TALER_TESTING_cmd_merchant_lock_product ("lock-product-too-much",
+ merchant_url,
+ "product-2",
+ GNUNET_TIME_UNIT_MINUTES,
+ 39,
+ MHD_HTTP_GONE),
TALER_TESTING_cmd_merchant_delete_product ("delete-product-locked",
merchant_url,
"product-2",
diff --git a/src/testing/testing_api_cmd_post_orders.c b/src/testing/testing_api_cmd_post_orders.c
index 6195d99c..86c00bbd 100644
--- a/src/testing/testing_api_cmd_post_orders.c
+++ b/src/testing/testing_api_cmd_post_orders.c
@@ -546,13 +546,13 @@ make_order_json (const char *order_id,
GNUNET_TIME_round_abs (&pay);
contract_terms = json_pack (
- "{s:s, s:s, s:s, s:s, s:o, s:o}",
+ "{s:s, s:s?, s:s, s:s, s:o, s:o}",
"summary", "merchant-lib testcase",
"order_id", order_id,
"amount", amount,
"fulfillment_url", "https://example.com",
- "refund_deadline", GNUNET_JSON_from_time_abs (refund_deadline),
- "pay_deadline", GNUNET_JSON_from_time_abs (pay_deadline)
+ "refund_deadline", GNUNET_JSON_from_time_abs (refund),
+ "pay_deadline", GNUNET_JSON_from_time_abs (pay)
);
*order = json_dumps (contract_terms, 0);