diff options
author | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-07-08 16:38:55 -0400 |
---|---|---|
committer | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-07-08 16:38:55 -0400 |
commit | 071554a7ac031cc859355b5ee353a708c0c5cea5 (patch) | |
tree | 1a1474f59e0645669f56018abb9f3f487230247f /src/testing/test_merchant_api.c | |
parent | a5e33f1a6d3f865a7c169783c63007cfdd3c30eb (diff) | |
download | merchant-071554a7ac031cc859355b5ee353a708c0c5cea5.tar.gz merchant-071554a7ac031cc859355b5ee353a708c0c5cea5.tar.bz2 merchant-071554a7ac031cc859355b5ee353a708c0c5cea5.zip |
removed more old code, more tests for post order, some twister tests for merchant-exchange requests
Diffstat (limited to 'src/testing/test_merchant_api.c')
-rw-r--r-- | src/testing/test_merchant_api.c | 140 |
1 files changed, 32 insertions, 108 deletions
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c index ca4a4472..10a378e8 100644 --- a/src/testing/test_merchant_api.c +++ b/src/testing/test_merchant_api.c @@ -89,11 +89,6 @@ static char *merchant_url; static struct GNUNET_OS_Process *merchantd; /** - * Map for #intern() - */ -static struct GNUNET_CONTAINER_MultiHashMap *interned_strings; - -/** * Account number of the exchange at the bank. */ #define EXCHANGE_ACCOUNT_NAME "2" @@ -157,70 +152,6 @@ cmd_transfer_to_exchange (const char *label, } -static const char * -intern (const char *str) -{ - struct GNUNET_HashCode hash; - const char *hs; - - if (NULL == interned_strings) - interned_strings = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO); - GNUNET_assert (NULL != interned_strings); - GNUNET_CRYPTO_hash (str, strlen (str), &hash); - hs = GNUNET_CONTAINER_multihashmap_get (interned_strings, &hash); - if (NULL != hs) - return hs; - hs = GNUNET_strdup (str); - GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put ( - interned_strings, - &hash, - (void *) hs, - GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); - return hs; -} - - -#define BUF_SZ 512 - -static const char * -merchant_url_internal (const char *instance_id) -{ - char buf[BUF_SZ]; - - if (NULL == instance_id) - GNUNET_snprintf (buf, - BUF_SZ, - "%s", - merchant_url); - else - GNUNET_snprintf (buf, - BUF_SZ, - "%sinstances/%s/", - merchant_url, - instance_id); - return intern (buf); -} - - -static const char * -merchant_url_external (const char *instance_id) -{ - char buf[BUF_SZ]; - if (NULL == instance_id) - GNUNET_snprintf (buf, - BUF_SZ, - "%spublic/", - merchant_url); - else - GNUNET_snprintf (buf, - BUF_SZ, - "%spublic/instances/%s/", - merchant_url, - instance_id); - return intern (buf); -} - - /** * Main function that will tell the interpreter what commands to * run. @@ -310,31 +241,6 @@ run (void *cls, false, false, MHD_HTTP_OK), -#if 0 - TALER_TESTING_cmd_check_payment ("check-payment-1", - merchant_url, - MHD_HTTP_OK, - "create-proposal-1", - GNUNET_NO), - TALER_TESTING_cmd_poll_payment_start ("poll-payment-1", - merchant_url, - "create-proposal-1", - NULL, - GNUNET_TIME_UNIT_MILLISECONDS), - TALER_TESTING_cmd_poll_payment_conclude ("poll-payment-conclude-1", - MHD_HTTP_OK, - "poll-payment-1", - GNUNET_NO), - TALER_TESTING_cmd_poll_payment_start ("poll-payment-2", - merchant_url, - "create-proposal-1", - NULL, - GNUNET_TIME_UNIT_MINUTES), - TALER_TESTING_cmd_check_payment_start ("check-payment-2", - merchant_url, - "create-proposal-1", - GNUNET_TIME_UNIT_MINUTES), -#endif TALER_TESTING_cmd_poll_order_start ("poll-order-merchant-1-start", merchant_url, "1", @@ -361,20 +267,6 @@ run (void *cls, true, false, MHD_HTTP_OK), -#if 0 - TALER_TESTING_cmd_poll_payment_conclude ("poll-payment-conclude-2", - MHD_HTTP_OK, - "poll-payment-2", - GNUNET_YES), - TALER_TESTING_cmd_check_payment_conclude ("check-payment-conclude-2", - MHD_HTTP_OK, - "check-payment-2", - GNUNET_YES), - TALER_TESTING_cmd_merchant_order_abort ("pay-abort-2", - merchant_url, - "deposit-simple", - MHD_HTTP_FORBIDDEN), -#endif TALER_TESTING_cmd_merchant_pay_order ("replay-simple", merchant_url, MHD_HTTP_OK, @@ -412,6 +304,38 @@ run (void *cls, false, NULL, MHD_HTTP_OK), + TALER_TESTING_cmd_merchant_post_products ("post-products-p3", + merchant_url, + "product-3", + "a product", + "EUR:1", + MHD_HTTP_NO_CONTENT), + TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-p3-wm-nx", + merchant_url, + MHD_HTTP_NOT_FOUND, + "{\"max_fee\":\"EUR:0.5\",\ + \"order_id\":\"order-p3\",\ + \"refund_deadline\": {\"t_ms\": 0},\ + \"pay_deadline\": {\"t_ms\": \"never\" },\ + \"amount\":\"EUR:5.0\",\ + \"summary\": \"merchant-lib testcase\",\ + \"fulfillment_url\": \"https://example.com/\",\ + \"products\": [ {\"description\":\"ice cream\",\ + \"value\":\"{EUR:5}\"} ] }", + "unsupported-wire-method"), + TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-p3", + merchant_url, + MHD_HTTP_OK, + "{\"max_fee\":\"EUR:0.5\",\ + \"order_id\":\"order-p3\",\ + \"refund_deadline\": {\"t_ms\": 0},\ + \"pay_deadline\": {\"t_ms\": \"never\" },\ + \"amount\":\"EUR:5.0\",\ + \"summary\": \"merchant-lib testcase\",\ + \"fulfillment_url\": \"https://example.com/\",\ + \"products\": [ {\"description\":\"ice cream\",\ + \"value\":\"{EUR:5}\"} ] }", + "x-taler-bank"), TALER_TESTING_cmd_merchant_delete_order ("delete-order-1", merchant_url, "1", |