From badec7af6eab1f0972f7d49527f5f0772589bb3f Mon Sep 17 00:00:00 2001 From: Jonathan Buchanan Date: Wed, 22 Jul 2020 05:03:04 -0400 Subject: tests for forget results --- src/testing/test_merchant_api.c | 159 ++++++++++++++++++++++++++-------------- 1 file changed, 104 insertions(+), 55 deletions(-) (limited to 'src/testing/test_merchant_api.c') diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c index 78377749..41fa321a 100644 --- a/src/testing/test_merchant_api.c +++ b/src/testing/test_merchant_api.c @@ -117,6 +117,29 @@ const char *payto_uris[] = { inactivation. */ }; +const char *order_1_transfers[] = { + "post-transfer-1", + NULL +}; + +const char *order_1_forgets_1[] = { + "forget-1", + NULL +}; + +const char *order_1_forgets_2[] = { + "forget-1", + "forget-order-array-elem", + NULL +}; + +const char *order_1_forgets_3[] = { + "forget-1", + "forget-order-array-elem", + "forget-order-array-wc", + NULL +}; + /** * Execute the taler-exchange-wirewatch command with @@ -171,11 +194,6 @@ static void run (void *cls, struct TALER_TESTING_Interpreter *is) { - const char *order_1_transfers[] = { - "post-transfer-1", - NULL - }; - struct TALER_TESTING_Command get_private_order_id[] = { TALER_TESTING_cmd_merchant_post_instances ("instance-create-default", @@ -311,71 +329,28 @@ run (void *cls, "withdraw-coin-1", "EUR:5", "EUR:4.99"), - TALER_TESTING_cmd_merchant_forget_order ("forget-1", - merchant_url, - MHD_HTTP_OK, - "create-proposal-1", - NULL, - "$.dummy_obj", - NULL), - TALER_TESTING_cmd_merchant_forget_order ("forget-unforgettable", - merchant_url, - MHD_HTTP_CONFLICT, - "create-proposal-1", - NULL, - "$.amount", - NULL), - TALER_TESTING_cmd_merchant_forget_order ("forget-order-nx", - merchant_url, - MHD_HTTP_NOT_FOUND, - NULL, - "nx-order", - "$.dummy_obj", - NULL), - TALER_TESTING_cmd_merchant_forget_order ("forget-order-array-elem", - merchant_url, - MHD_HTTP_OK, - "create-proposal-1", - NULL, - "$.dummy_array[0].item", - NULL), - TALER_TESTING_cmd_merchant_forget_order ("forget-order-array-wc", - merchant_url, - MHD_HTTP_OK, - "create-proposal-1", - NULL, - "$.dummy_array[*].item", - NULL), - TALER_TESTING_cmd_merchant_forget_order ("forget-order-malformed", - merchant_url, - MHD_HTTP_BAD_REQUEST, - "create-proposal-1", - NULL, - "$.dummy_array[abc].item", - NULL), TALER_TESTING_cmd_poll_order_conclude ("poll-order-merchant-1-conclude", MHD_HTTP_OK, "poll-order-merchant-1-start"), - /* TALER_TESTING_cmd_wallet_get_order ("get-order-wallet-1-2", merchant_url, "create-proposal-1", true, false, - MHD_HTTP_OK),*/ - /*TALER_TESTING_cmd_merchant_get_order ("get-order-merchant-1-2", + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_get_order ("get-order-merchant-1-2", merchant_url, "create-proposal-1", true, false, - MHD_HTTP_OK),*/ - /*TALER_TESTING_cmd_merchant_pay_order ("replay-simple", + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_pay_order ("replay-simple", merchant_url, MHD_HTTP_OK, "create-proposal-1", "withdraw-coin-1", "EUR:5", - "EUR:4.99"),*/ + "EUR:4.99"), TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-1"), CMD_EXEC_AGGREGATOR ("run-aggregator"), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-498c", @@ -397,7 +372,24 @@ run (void *cls, MHD_HTTP_OK, "post-transfer-1", NULL), - /*TALER_TESTING_cmd_merchant_get_order2 ("get-order-merchant-1-2", + TALER_TESTING_cmd_merchant_get_order2 ("get-order-merchant-1-2", + merchant_url, + "create-proposal-1", + true, + true, + order_1_transfers, + false, + NULL, + NULL, + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_forget_order ("forget-1", + merchant_url, + MHD_HTTP_OK, + "create-proposal-1", + NULL, + "$.dummy_obj", + NULL), + TALER_TESTING_cmd_merchant_get_order2 ("get-order-merchant-1-forget-1", merchant_url, "create-proposal-1", true, @@ -405,7 +397,63 @@ run (void *cls, order_1_transfers, false, NULL, - MHD_HTTP_OK),*/ + order_1_forgets_1, + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_forget_order ("forget-unforgettable", + merchant_url, + MHD_HTTP_CONFLICT, + "create-proposal-1", + NULL, + "$.amount", + NULL), + TALER_TESTING_cmd_merchant_forget_order ("forget-order-nx", + merchant_url, + MHD_HTTP_NOT_FOUND, + NULL, + "nx-order", + "$.dummy_obj", + NULL), + TALER_TESTING_cmd_merchant_forget_order ("forget-order-array-elem", + merchant_url, + MHD_HTTP_OK, + "create-proposal-1", + NULL, + "$.dummy_array[0].item", + NULL), + TALER_TESTING_cmd_merchant_get_order2 ("get-order-merchant-1-forget-2", + merchant_url, + "create-proposal-1", + true, + true, + order_1_transfers, + false, + NULL, + order_1_forgets_2, + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_forget_order ("forget-order-array-wc", + merchant_url, + MHD_HTTP_OK, + "create-proposal-1", + NULL, + "$.dummy_array[*].item", + NULL), + TALER_TESTING_cmd_merchant_get_order2 ("get-order-merchant-1-forget-3", + merchant_url, + "create-proposal-1", + true, + true, + order_1_transfers, + false, + NULL, + order_1_forgets_3, + MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_forget_order ("forget-order-malformed", + merchant_url, + MHD_HTTP_BAD_REQUEST, + "create-proposal-1", + NULL, + "$.dummy_array[abc].item", + NULL), TALER_TESTING_cmd_merchant_post_products ("post-products-p3", merchant_url, "product-3", @@ -611,6 +659,7 @@ run (void *cls, NULL, true, order_1r_refunds, + NULL, MHD_HTTP_OK), #if 0 TALER_TESTING_cmd_poll_payment_conclude ("poll-payment-refund-conclude-1", -- cgit v1.2.3