summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-12-18 15:04:18 +0100
committerMarcello Stanisci <stanisci.m@gmail.com>2018-12-18 15:04:18 +0100
commited9118124ef911018ee6788d681fc865fd1b40e6 (patch)
treeab20f2498bf7c424208aafa49aff6e3e7999cc4a
parent31ea5ff0dd8a5ea05bd681477bbc1313be1b4be8 (diff)
downloadmerchant-ed9118124ef911018ee6788d681fc865fd1b40e6.tar.gz
merchant-ed9118124ef911018ee6788d681fc865fd1b40e6.tar.bz2
merchant-ed9118124ef911018ee6788d681fc865fd1b40e6.zip
/tip/*: #5284
-rw-r--r--src/include/taler_merchant_testing_lib.h20
-rw-r--r--src/lib/test_merchant_api_new.c22
-rw-r--r--src/lib/testing_api_cmd_tip.c56
3 files changed, 9 insertions, 89 deletions
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h
index adb164b6..a1e55aaa 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -605,7 +605,6 @@ TALER_TESTING_get_trait_refund_entry
* serve the /tip-authorize request.
* @param exchange_url the base URL of the exchange that owns
* the reserve from which the tip is going to be gotten.
- * @param ctx the CURL context to carry on the HTTP work.
* @param http_status the HTTP response code which is expected
* for this operation.
* @param instance which merchant instance is running this CMD.
@@ -619,7 +618,6 @@ 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,
@@ -649,7 +647,6 @@ TALER_TESTING_cmd_tip_authorize_fake
* serve the /tip-authorize request.
* @param exchange_url the base URL of the exchange that owns
* the reserve from which the tip is going to be gotten.
- * @param ctx the CURL context to carry on the HTTP work.
* @param http_status the HTTP response code which is expected
* for this operation.
* @param instance which merchant instance is running this CMD.
@@ -661,7 +658,6 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_tip_authorize (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,
@@ -673,7 +669,6 @@ TALER_TESTING_cmd_tip_authorize (const char *label,
* @param label the command label
* @param merchant_url base URL of the merchant which will
* server the /tip-query request.
- * @param ctx CURL context to carry on the HTTP work.
* @param http_status expected HTTP response code for the
* /tip-query request.
* @param instance the merchant instance running this CMD.
@@ -681,7 +676,6 @@ TALER_TESTING_cmd_tip_authorize (const char *label,
struct TALER_TESTING_Command
TALER_TESTING_cmd_tip_query (const char *label,
const char *merchant_url,
- struct GNUNET_CURL_Context *ctx,
unsigned int http_status,
const char *instance);
/**
@@ -690,7 +684,6 @@ TALER_TESTING_cmd_tip_query (const char *label,
* @param label the command label
* @param merchant_url base URL of the merchant which will
* server the /tip-query request.
- * @param ctx CURL context to carry on the HTTP work.
* @param http_status expected HTTP response code for the
* /tip-query request.
* @param instance the merchant instance running this CMD.
@@ -704,7 +697,6 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_tip_query_with_amounts
(const char *label,
const char *merchant_url,
- struct GNUNET_CURL_Context *ctx,
unsigned int http_status,
const char *instance,
const char *expected_amount_picked_up,
@@ -718,25 +710,20 @@ TALER_TESTING_cmd_tip_query_with_amounts
* @param label the command label
* @param merchant_url base URL of the backend which will serve
* the /tip-pickup request.
- * @param ctx CURL context to carry on HTTP work.
* @param http_status expected HTTP response code.
* @param authorize_reference reference to a /tip-autorize CMD
* that offers a tip id to pick up.
* @param amounts array of string-defined amounts that specifies
* which denominations will be accepted for tipping.
- * @param exchange connection handle to the exchange that will
- * eventually serve the withdraw operation.
* @param ec expected Taler error code.
*/
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);
/**
@@ -745,24 +732,19 @@ TALER_TESTING_cmd_tip_pickup_with_ec
* @param label the command label
* @param merchant_url base URL of the backend which will serve
* the /tip-pickup request.
- * @param ctx CURL context to carry on HTTP work.
* @param http_status expected HTTP response code.
* @param authorize_reference reference to a /tip-autorize CMD
* that offers a tip id to pick up.
* @param amounts array of string-defined amounts that specifies
* which denominations will be accepted for tipping.
- * @param exchange connection handle to the exchange that will
- * eventually serve the withdraw operation.
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_tip_pickup
(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);
+ const char **amounts);
/**
* Make the instruction pointer point to @a new_ip
diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c
index c6a5f85c..824749aa 100644
--- a/src/lib/test_merchant_api_new.c
+++ b/src/lib/test_merchant_api_new.c
@@ -628,7 +628,6 @@ run (void *cls,
TALER_TESTING_cmd_tip_authorize ("authorize-tip-1",
merchant_url,
exchange_url,
- is->ctx,
MHD_HTTP_OK,
"tip",
"tip 1",
@@ -637,7 +636,6 @@ run (void *cls,
TALER_TESTING_cmd_tip_authorize ("authorize-tip-2",
merchant_url,
exchange_url,
- is->ctx,
MHD_HTTP_OK,
"tip",
"tip 2",
@@ -652,7 +650,6 @@ run (void *cls,
("authorize-tip-null",
merchant_url,
exchange_url,
- is->ctx,
MHD_HTTP_NOT_FOUND,
"nulltip",
"tip 2",
@@ -661,13 +658,11 @@ run (void *cls,
TALER_TESTING_cmd_tip_query ("query-tip-1",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"tip"),
TALER_TESTING_cmd_tip_query_with_amounts ("query-tip-2",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"tip",
"EUR:0.0", // picked
@@ -676,15 +671,12 @@ run (void *cls,
TALER_TESTING_cmd_tip_pickup ("pickup-tip-1",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"authorize-tip-1",
- pickup_amounts_1,
- is->exchange),
+ pickup_amounts_1),
TALER_TESTING_cmd_tip_query_with_amounts ("query-tip-3",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"tip",
"EUR:5.01", // picked
@@ -693,15 +685,12 @@ run (void *cls,
TALER_TESTING_cmd_tip_pickup ("pickup-tip-2",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"authorize-tip-2",
- pickup_amounts_1,
- is->exchange),
+ pickup_amounts_1),
TALER_TESTING_cmd_tip_query_with_amounts ("query-tip-4",
merchant_url,
- is->ctx,
MHD_HTTP_OK,
"tip",
"EUR:10.02", // pick
@@ -734,7 +723,6 @@ run (void *cls,
("authorize-tip-3-insufficient-funds",
merchant_url,
exchange_url,
- is->ctx,
MHD_HTTP_PRECONDITION_FAILED,
"dtip",
"tip 3",
@@ -745,7 +733,6 @@ run (void *cls,
("authorize-tip-4-unknown-instance",
merchant_url,
exchange_url,
- is->ctx,
MHD_HTTP_NOT_FOUND,
"unknown",
"tip 4",
@@ -756,7 +743,6 @@ run (void *cls,
("authorize-tip-5-notip-instance",
merchant_url,
exchange_url,
- is->ctx,
MHD_HTTP_NOT_FOUND,
"default",
"tip 5",
@@ -766,11 +752,9 @@ run (void *cls,
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),
TALER_TESTING_cmd_tip_authorize_fake
@@ -779,11 +763,9 @@ run (void *cls,
TALER_TESTING_cmd_tip_pickup_with_ec
("pickup-non-existent-id",
merchant_url,
- is->ctx,
MHD_HTTP_NOT_FOUND,
"fake-tip-authorization",
pickup_amounts_1,
- is->exchange,
TALER_EC_TIP_PICKUP_TIP_ID_UNKNOWN),
TALER_TESTING_cmd_proposal
diff --git a/src/lib/testing_api_cmd_tip.c b/src/lib/testing_api_cmd_tip.c
index b939d8e5..1aff5451 100644
--- a/src/lib/testing_api_cmd_tip.c
+++ b/src/lib/testing_api_cmd_tip.c
@@ -45,11 +45,6 @@ struct TipPickupState
const char *exchange_url;
/**
- * CURL context.
- */
- struct GNUNET_CURL_Context *ctx;
-
- /**
* Expected HTTP response code.
*/
unsigned int http_status;
@@ -124,11 +119,6 @@ struct TipPickupState
* response code).
*/
enum TALER_ErrorCode expected_ec;
-
- /**
- * The connection to the exchange.
- */
- struct TALER_EXCHANGE_Handle *exchange;
};
@@ -144,11 +134,6 @@ struct TipQueryState
const char *merchant_url;
/**
- * The CURL context.
- */
- struct GNUNET_CURL_Context *ctx;
-
- /**
* Expected HTTP response code for this CMD.
*/
unsigned int http_status;
@@ -198,11 +183,6 @@ struct TipAuthorizeState
const char *merchant_url;
/**
- * CURL context.
- */
- struct GNUNET_CURL_Context *ctx;
-
- /**
* Expected HTTP response code.
*/
unsigned int http_status;
@@ -375,7 +355,7 @@ tip_authorize_run (void *cls,
TALER_TESTING_FAIL (is);
tas->tao = TALER_MERCHANT_tip_authorize
- (tas->ctx,
+ (is->ctx,
tas->merchant_url,
"http://merchant.com/pickup",
"http://merchant.com/continue",
@@ -444,7 +424,6 @@ tip_authorize_cleanup (void *cls,
* serve the /tip-authorize request.
* @param exchange_url the base URL of the exchange that owns
* the reserve from which the tip is going to be gotten.
- * @param ctx the CURL context to carry on the HTTP work.
* @param http_status the HTTP response code which is expected
* for this operation.
* @param instance which merchant instance is running this CMD.
@@ -458,7 +437,6 @@ 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,
@@ -471,7 +449,6 @@ TALER_TESTING_cmd_tip_authorize_with_ec
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;
@@ -497,7 +474,6 @@ TALER_TESTING_cmd_tip_authorize_with_ec
* serve the /tip-authorize request.
* @param exchange_url the base URL of the exchange that owns
* the reserve from which the tip is going to be gotten.
- * @param ctx the CURL context to carry on the HTTP work.
* @param http_status the HTTP response code which is expected
* for this operation.
* @param instance which merchant instance is running this CMD.
@@ -509,7 +485,6 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_tip_authorize (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,
@@ -521,7 +496,6 @@ TALER_TESTING_cmd_tip_authorize (const char *label,
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;
@@ -653,7 +627,7 @@ tip_query_run (void *cls,
struct TipQueryState *tqs = cls;
tqs->is = is;
- tqs->tqo = TALER_MERCHANT_tip_query (tqs->ctx,
+ tqs->tqo = TALER_MERCHANT_tip_query (is->ctx,
tqs->merchant_url,
tqs->instance,
&tip_query_cb,
@@ -668,7 +642,6 @@ tip_query_run (void *cls,
* @param label the command label
* @param merchant_url base URL of the merchant which will
* server the /tip-query request.
- * @param ctx CURL context to carry on the HTTP work.
* @param http_status expected HTTP response code for the
* /tip-query request.
* @param instance the merchant instance running this CMD.
@@ -684,7 +657,6 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_tip_query_with_amounts
(const char *label,
const char *merchant_url,
- struct GNUNET_CURL_Context *ctx,
unsigned int http_status,
const char *instance,
const char *expected_amount_picked_up,
@@ -696,7 +668,6 @@ TALER_TESTING_cmd_tip_query_with_amounts
tqs = GNUNET_new (struct TipQueryState);
tqs->merchant_url = merchant_url;
- tqs->ctx = ctx;
tqs->instance = instance;
tqs->http_status = http_status;
tqs->expected_amount_picked_up = expected_amount_picked_up;
@@ -718,7 +689,6 @@ TALER_TESTING_cmd_tip_query_with_amounts
* @param label the command label
* @param merchant_url base URL of the merchant which will
* server the /tip-query request.
- * @param ctx CURL context to carry on the HTTP work.
* @param http_status expected HTTP response code for the
* /tip-query request.
* @param instance the merchant instance running this CMD.
@@ -726,7 +696,6 @@ TALER_TESTING_cmd_tip_query_with_amounts
struct TALER_TESTING_Command
TALER_TESTING_cmd_tip_query (const char *label,
const char *merchant_url,
- struct GNUNET_CURL_Context *ctx,
unsigned int http_status,
const char *instance)
{
@@ -735,7 +704,6 @@ TALER_TESTING_cmd_tip_query (const char *label,
tqs = GNUNET_new (struct TipQueryState);
tqs->merchant_url = merchant_url;
- tqs->ctx = ctx;
tqs->instance = instance;
tqs->http_status = http_status;
@@ -912,7 +880,7 @@ pickup_cb (void *cls,
( (NULL == tps->sigs) ||
(NULL == tps->sigs[wh->off].rsa_signature) ) );
wh->wsh = TALER_EXCHANGE_reserve_withdraw2
- (tps->exchange,
+ (tps->is->exchange,
tps->dks[i],
&reserve_sigs[i],
reserve_pub,
@@ -947,7 +915,7 @@ tip_pickup_run (void *cls,
const struct GNUNET_HashCode *tip_id;
tps->is = is;
- tps->exchange_url = TALER_EXCHANGE_get_base_url (tps->exchange);
+ tps->exchange_url = TALER_EXCHANGE_get_base_url (is->exchange);
if (NULL == tps->replay_reference)
{
replay_cmd = NULL;
@@ -1029,7 +997,7 @@ tip_pickup_run (void *cls,
(authorize_cmd, 0, &tip_id))
TALER_TESTING_FAIL (is);
- tps->tpo = TALER_MERCHANT_tip_pickup (tps->ctx,
+ tps->tpo = TALER_MERCHANT_tip_pickup (is->ctx,
tps->merchant_url,
tip_id,
num_planchets,
@@ -1128,7 +1096,6 @@ tip_pickup_traits (void *cls,
* @param label the command label
* @param merchant_url base URL of the backend which will serve
* the /tip-pickup request.
- * @param ctx CURL context to carry on HTTP work.
* @param http_status expected HTTP response code.
* @param authorize_reference reference to a /tip-autorize CMD
* that offers a tip id to pick up.
@@ -1142,11 +1109,9 @@ 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;
@@ -1154,10 +1119,8 @@ TALER_TESTING_cmd_tip_pickup_with_ec
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;
@@ -1176,34 +1139,27 @@ TALER_TESTING_cmd_tip_pickup_with_ec
* @param label the command label
* @param merchant_url base URL of the backend which will serve
* the /tip-pickup request.
- * @param ctx CURL context to carry on HTTP work.
* @param http_status expected HTTP response code.
* @param authorize_reference reference to a /tip-autorize CMD
* that offers a tip id to pick up.
* @param amounts array of string-defined amounts that specifies
* which denominations will be accepted for tipping.
- * @param exchange connection handle to the exchange that will
- * eventually serve the withdraw operation.
*/
struct TALER_TESTING_Command
TALER_TESTING_cmd_tip_pickup
(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)
+ const char **amounts)
{
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;
cmd.cls = tps;