diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2018-03-23 13:35:37 +0100 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2018-03-23 13:35:37 +0100 |
commit | dfd4806100b0f3dc4f5947b3a85872b08d64981b (patch) | |
tree | da8a62826f81076c954c6b12efa3042088497e9a | |
parent | db34b15011cfe0231862fcf85c26a17af9dd5d95 (diff) | |
download | merchant-dfd4806100b0f3dc4f5947b3a85872b08d64981b.tar.gz merchant-dfd4806100b0f3dc4f5947b3a85872b08d64981b.tar.bz2 merchant-dfd4806100b0f3dc4f5947b3a85872b08d64981b.zip |
testing until last pickup ("too much" one)
-rw-r--r-- | src/include/taler_merchant_testing_lib.h | 33 | ||||
-rw-r--r-- | src/lib/test_merchant_api.c | 1 | ||||
-rw-r--r-- | src/lib/test_merchant_api_new.c | 44 | ||||
-rw-r--r-- | src/lib/testing_api_cmd_tip.c | 74 |
4 files changed, 152 insertions, 0 deletions
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h index a242e6d8..67ca40aa 100644 --- a/src/include/taler_merchant_testing_lib.h +++ b/src/include/taler_merchant_testing_lib.h @@ -497,6 +497,23 @@ TALER_TESTING_get_trait_refund_entry unsigned int index, const struct TALER_MERCHANT_RefundEntry **refund_entry); + +/** + * FIXME + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_tip_authorize_with_ec + (const char *label, + const char *merchant_url, + const char *exchange_url, + struct GNUNET_CURL_Context *ctx, + unsigned int http_status, + const char *instance, + const char *justification, + const char *amount, + enum TALER_ErrorCode ec); + + /** * FIXME */ @@ -534,6 +551,22 @@ TALER_TESTING_cmd_tip_query_with_amounts const char *expected_amount_authorized, const char *expected_amount_available); + +/** + * FIXME + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_tip_pickup_with_ec + (const char *label, + const char *merchant_url, + struct GNUNET_CURL_Context *ctx, + unsigned int http_status, + const char *authorize_reference, + const char **amounts, + struct TALER_EXCHANGE_Handle *exchange, + enum TALER_ErrorCode ec); + + /** * FIXME */ diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c index 807376c5..3177a1af 100644 --- a/src/lib/test_merchant_api.c +++ b/src/lib/test_merchant_api.c @@ -4625,6 +4625,7 @@ run (void *cls) .details.tip_authorize.justification = "tip 5", .details.tip_authorize.amount = "EUR:5.01", .details.tip_authorize.expected_ec = TALER_EC_TIP_AUTHORIZE_INSTANCE_DOES_NOT_TIP }, + { .oc = OC_TIP_PICKUP, .label = "pickup-tip-3-too-much", .expected_response_code = MHD_HTTP_CONFLICT, diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c index c444c2fc..2b6ad910 100644 --- a/src/lib/test_merchant_api_new.c +++ b/src/lib/test_merchant_api_new.c @@ -35,6 +35,7 @@ #include <taler/taler_bank_service.h> #include <taler/taler_fakebank_lib.h> #include <taler/taler_testing_lib.h> +#include <taler/taler_error_codes.h> #include "taler_merchant_testing_lib.h" /** @@ -547,6 +548,49 @@ run (void *cls, "EUR:10.02", // pick "EUR:10.02", // auth "EUR:10.02"), // ava + TALER_TESTING_cmd_tip_authorize_with_ec + ("authorize-tip-3-insufficient-funds", + merchant_url, + exchange_url, + is->ctx, + MHD_HTTP_PRECONDITION_FAILED, + "dtip", + "tip 3", + "EUR:5.01", + TALER_EC_TIP_AUTHORIZE_INSUFFICIENT_FUNDS), + + TALER_TESTING_cmd_tip_authorize_with_ec + ("authorize-tip-4-unknown-instance", + merchant_url, + exchange_url, + is->ctx, + MHD_HTTP_NOT_FOUND, + "unknown", + "tip 4", + "EUR:5.01", + TALER_EC_TIP_AUTHORIZE_INSTANCE_UNKNOWN), + + TALER_TESTING_cmd_tip_authorize_with_ec + ("authorize-tip-5-notip-instance", + merchant_url, + exchange_url, + is->ctx, + MHD_HTTP_NOT_FOUND, + "default", + "tip 5", + "EUR:5.01", + TALER_EC_TIP_AUTHORIZE_INSTANCE_DOES_NOT_TIP), + + + TALER_TESTING_cmd_tip_pickup_with_ec + ("pickup-tip-3-too-much", + merchant_url, + is->ctx, + MHD_HTTP_CONFLICT, + "authorize-tip-1", + pickup_amounts_1, + is->exchange, + TALER_EC_TIP_PICKUP_NO_FUNDS), /* Will fail here until all new * transfers have not been checked. I.e., diff --git a/src/lib/testing_api_cmd_tip.c b/src/lib/testing_api_cmd_tip.c index eb87034c..c784dbcc 100644 --- a/src/lib/testing_api_cmd_tip.c +++ b/src/lib/testing_api_cmd_tip.c @@ -287,6 +287,44 @@ tip_authorize_cleanup (void *cls, * FIXME */ struct TALER_TESTING_Command +TALER_TESTING_cmd_tip_authorize_with_ec + (const char *label, + const char *merchant_url, + const char *exchange_url, + struct GNUNET_CURL_Context *ctx, + unsigned int http_status, + const char *instance, + const char *justification, + const char *amount, + enum TALER_ErrorCode ec) +{ + struct TipAuthorizeState *tas; + struct TALER_TESTING_Command cmd; + + tas = GNUNET_new (struct TipAuthorizeState); + tas->merchant_url = merchant_url; + tas->exchange_url = exchange_url; + tas->ctx = ctx; + tas->instance = instance; + tas->justification = justification; + tas->amount = amount; + tas->http_status = http_status; + tas->expected_ec = ec; + + cmd.label = label; + cmd.cls = tas; + cmd.run = &tip_authorize_run; + cmd.cleanup = &tip_authorize_cleanup; + cmd.traits = &tip_authorize_traits; + + return cmd; +} + + +/** + * FIXME + */ +struct TALER_TESTING_Command TALER_TESTING_cmd_tip_authorize (const char *label, const char *merchant_url, const char *exchange_url, @@ -815,6 +853,42 @@ tip_pickup_traits (void *cls, * FIXME */ struct TALER_TESTING_Command +TALER_TESTING_cmd_tip_pickup_with_ec + (const char *label, + const char *merchant_url, + struct GNUNET_CURL_Context *ctx, + unsigned int http_status, + const char *authorize_reference, + const char **amounts, + struct TALER_EXCHANGE_Handle *exchange, + enum TALER_ErrorCode ec) +{ + struct TipPickupState *tps; + struct TALER_TESTING_Command cmd; + + tps = GNUNET_new (struct TipPickupState); + tps->merchant_url = merchant_url; + tps->ctx = ctx; + tps->authorize_reference = authorize_reference; + tps->amounts = amounts; + tps->exchange = exchange; + tps->http_status = http_status; + tps->expected_ec = ec; + + cmd.cls = tps; + cmd.label = label; + cmd.run = &tip_pickup_run; + cmd.cleanup = &tip_pickup_cleanup; + cmd.traits = &tip_pickup_traits; + + return cmd; +} + + +/** + * FIXME + */ +struct TALER_TESTING_Command TALER_TESTING_cmd_tip_pickup (const char *label, const char *merchant_url, |