diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-10-15 14:27:39 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-10-15 14:27:39 +0200 |
commit | f353a1efeab21e46ccdb203e15a848345775f451 (patch) | |
tree | 851971c58f563f27d3ecc963d34484d6a28cb12e | |
parent | deb427412b5b4229590b91548d66f64e3f69f15b (diff) |
expand test suite, remove obsolete functions from header
-rw-r--r-- | src/include/taler_merchant_testing_lib.h | 210 | ||||
-rw-r--r-- | src/testing/test_merchant_api.c | 49 |
2 files changed, 20 insertions, 239 deletions
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h index 8b53c324..27a49f19 100644 --- a/src/include/taler_merchant_testing_lib.h +++ b/src/include/taler_merchant_testing_lib.h @@ -1352,216 +1352,6 @@ TALER_TESTING_cmd_tip_pickup (const char *label, const char **amounts); -/* ******************** OLD ******************* */ - - -/** - * Make a "check payment" test command. - * - * @param label command label. - * @param merchant_url merchant base url - * @param http_status expected HTTP response code. - * @param proposal_reference the proposal whose payment status - * is going to be checked. - * @param expect_paid #GNUNET_YES if we expect the proposal to be - * paid, #GNUNET_NO otherwise. - * @return the command - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_check_payment (const char *label, - const char *merchant_url, - unsigned int http_status, - const char *proposal_reference, - unsigned int expect_paid); - - -/** - * Make a "check payment" test command with long polling support. - * - * @param label command label. - * @param merchant_url merchant base url - * @param proposal_reference the proposal whose payment status - * is going to be checked. - * @param timeout how long to wait during long polling for the reply - * @return the command - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_check_payment_start (const char *label, - const char *merchant_url, - const char *proposal_reference, - struct GNUNET_TIME_Relative timeout); - - -/** - * Expect completion of a long-polled "check payment" test command. - * - * @param label command label. - * @param check_start_reference payment start operation that should have - * completed - * @param http_status expected HTTP response code. - * @param expect_paid #GNUNET_YES if we expect the proposal to be - * paid, #GNUNET_NO otherwise. - * @return the command - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_check_payment_conclude (const char *label, - unsigned int http_status, - const char *poll_start_reference, - unsigned int expect_paid); - - -/** - * Start a long-polled "poll-payment" test command. - * - * @param label command label. - * @param merchant_url merchant base url - * @param proposal_reference the proposal whose payment status - * is going to be checked. - * @param min_refund minimum refund to wait for - * @param timeout which timeout to use - * @return the command - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_poll_payment_start (const char *label, - const char *merchant_url, - const char *proposal_reference, - const char *min_refund, - struct GNUNET_TIME_Relative timeout); - - -/** - * Expect completion of a long-polled "poll payment" test command. - * - * @param label command label. - * @param poll_start_reference payment start operation that should have - * completed - * @param http_status expected HTTP response code. - * @param expect_paid #GNUNET_YES if we expect the proposal to be - * paid, #GNUNET_NO otherwise. - * @return the command - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_poll_payment_conclude (const char *label, - unsigned int http_status, - const char *poll_start_reference, - unsigned int expect_paid); - - -/** - * Define a "refund lookup" CMD. - * - * @param label command label. - * @param merchant_url base URL of the merchant serving the - * "refund lookup" request. - * @param increase_reference reference to a "refund increase" CMD - * that will offer the amount to check the looked up refund - * against. Must NOT be NULL. - * @param pay_reference reference to the "pay" CMD whose coins got - * refunded. It is used to double-check if the refunded - * coins were actually spent in the first place. - * @param order_id order id whose refund status is to be looked up. - * @param http_code expected HTTP response code. - * - * @return the command. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_refund_lookup (const char *label, - const char *merchant_url, - const char *increase_reference, - const char *pay_reference, - const char *order_id, - unsigned int http_code); - -/** - * Define a "refund lookup" CMD, equipped with a expected refund - * amount. - * - * @param label command label. - * @param merchant_url base URL of the merchant serving the - * "refund lookup" request. - * @param increase_reference reference to a "refund increase" CMD - * that will offer the amount to check the looked up refund - * against. Can be NULL, takes precedence over @a - * refund_amount. - * @param pay_reference reference to the "pay" CMD whose coins got - * refunded. It is used to double-check if the refunded - * coins were actually spent in the first place. - * @param order_id order id whose refund status is to be looked up. - * @param http_code expected HTTP response code. - * @param refund_amount expected refund amount. Must be defined - * if @a increase_reference is NULL. - * - * @return the command. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_refund_lookup_with_amount (const char *label, - const char *merchant_url, - const char *increase_reference, - const char *pay_reference, - const char *order_id, - unsigned int http_code, - const char *refund_amount); - - -/** - * Make a "history" command. - * - * @param label command label. - * @param merchant_url base URL of the merchant serving the - * request. - * @param http_status expected HTTP response code - * @param time limit towards the past for the history - * records we want returned. - * @param nresult how many results are expected - * @param nrows how many row we want to receive, at most. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_history_default_start (const char *label, - const char *merchant_url, - unsigned int http_status, - struct GNUNET_TIME_Absolute time, - unsigned int nresult, - long long nrows); - -/** - * Make a "history" command. - * - * @param label command label. - * @param merchant_url base URL of the merchant serving the - * request. - * @param http_status expected HTTP response code - * @param time limit towards the past for the history - * records we want returned. - * @param nresult how many results are expected - * @param start first row id we want in the result. - * @param nrows how many row we want to receive, at most. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_history (const char *label, - const char *merchant_url, - unsigned int http_status, - struct GNUNET_TIME_Absolute time, - unsigned int nresult, - unsigned long long start, - long long nrows); - -/** - * Define a "track transfer" CMD. - * - * @param label command label. - * @param merchant_url base URL of the merchant serving the - * /track/transfer request. - * @param http_status expected HTTP response code. - * @param check_bank_reference reference to a "check bank" CMD - * that will provide the WTID and exchange URL to issue - * the track against. - */ -struct TALER_TESTING_Command -TALER_TESTING_cmd_merchant_track_transfer (const char *label, - const char *merchant_url, - unsigned int http_status, - const char *check_bank_reference); - /* ****** Specific traits supported by this component ******* */ /** diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c index e738ca0d..17984079 100644 --- a/src/testing/test_merchant_api.c +++ b/src/testing/test_merchant_api.c @@ -337,6 +337,11 @@ run (void *cls, TALER_MERCHANT_OSC_CLAIMED, false, MHD_HTTP_OK), + TALER_TESTING_cmd_wallet_poll_order_start ("poll-order-wallet-start-1", + merchant_url, + "create-proposal-1", + GNUNET_TIME_UNIT_MINUTES, + NULL), TALER_TESTING_cmd_poll_order_start ("poll-order-merchant-1-start", merchant_url, "1", @@ -352,6 +357,10 @@ run (void *cls, TALER_TESTING_cmd_poll_order_conclude ("poll-order-merchant-1-conclude", MHD_HTTP_OK, "poll-order-merchant-1-start"), + TALER_TESTING_cmd_wallet_poll_order_conclude ("poll-order-1-conclude", + MHD_HTTP_OK, + NULL, + "poll-order-wallet-start-1"), TALER_TESTING_cmd_merchant_post_orders_paid ("verify-order-1-paid", merchant_url, "deposit-simple", @@ -606,12 +615,14 @@ run (void *cls, * all records to be returned; setting date as 0 lets the * interpreter set it as 'now' + one hour delta, just to * make sure it surpasses the proposal's timestamp. - */GNUNET_TIME_UNIT_ZERO_ABS, + */// + GNUNET_TIME_UNIT_ZERO_ABS, /** * We only expect ONE result (create-proposal-1) to be * included in /history response, because create-proposal-3 * did NOT go through because of double spending. - */1, // nresult + */// + 1, // nresult 10, // start -10), // nrows #endif @@ -665,13 +676,10 @@ run (void *cls, "EUR:5", "EUR:4.99", NULL), -#if 0 - TALER_TESTING_cmd_poll_payment_start ("poll-payment-refund-1", - merchant_url, - "create-proposal-1r", - "EUR:0.0", - GNUNET_TIME_UNIT_MINUTES), -#endif + TALER_TESTING_cmd_poll_order_start ("poll-payment-refund-1", + merchant_url, + "1r", /* proposal name, not cmd ref! */ + GNUNET_TIME_UNIT_MINUTES), TALER_TESTING_cmd_merchant_order_refund ("refund-increase-1r", merchant_url, "refund test", @@ -731,26 +739,9 @@ run (void *cls, order_1r_refunds, NULL, MHD_HTTP_OK), -#if 0 - TALER_TESTING_cmd_poll_payment_conclude ("poll-payment-refund-conclude-1", - MHD_HTTP_OK, - "poll-payment-refund-1", - GNUNET_YES), - /* Ordinary refund. */ - TALER_TESTING_cmd_refund_lookup ("refund-lookup-1r", - merchant_url, - "refund-increase-1r", - "pay-for-refund-1r", - "1r", - MHD_HTTP_OK), - /* Trying to pick up refund from non existent proposal. */ - TALER_TESTING_cmd_refund_lookup ("refund-lookup-non-existent", - merchant_url, - "refund-increase-1r", - "deposit-simple", - "non-existend-id", - MHD_HTTP_NOT_FOUND), -#endif + TALER_TESTING_cmd_poll_order_conclude ("poll-payment-refund-conclude-1", + MHD_HTTP_OK, + "poll-payment-refund-1"), /* Test /refund on a contract that was never paid. */ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-not-to-be-paid", |