summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-06-28 16:22:24 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-06-28 16:22:24 +0200
commite7eba2a0200fbc408df9c48a45cb1af432f59953 (patch)
tree23849246859dca80d13b1bc8c183fe71eff8c34f /src/lib
parentec0c992568f518249aa21c04a650e1785b90994e (diff)
downloadmerchant-e7eba2a0200fbc408df9c48a45cb1af432f59953.tar.gz
merchant-e7eba2a0200fbc408df9c48a45cb1af432f59953.tar.bz2
merchant-e7eba2a0200fbc408df9c48a45cb1af432f59953.zip
Moving #5366 chunk into twisted tests, + fix it.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/test_merchant_api_new.c76
-rw-r--r--src/lib/test_merchant_api_twisted.c83
-rw-r--r--src/lib/testing_api_cmd_proposal.c4
3 files changed, 85 insertions, 78 deletions
diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c
index 898106fb..17fcd5bb 100644
--- a/src/lib/test_merchant_api_new.c
+++ b/src/lib/test_merchant_api_new.c
@@ -335,79 +335,6 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
- /**
- * This block tests whether a refund_deadline and/or
- * wire_transfer_deadline very far in the future do NOT
- * result in any wire transfer from the aggregator (#5366).
- */
- struct TALER_TESTING_Command unaggregation[] = {
-
- #if HAVE_TALER_TALER_TWISTER_TESTING_LIB_H
- CMD_TRANSFER_TO_EXCHANGE
- ("create-reserve-unaggregation",
- "EUR:5.01"),
-
- CMD_EXEC_WIREWATCH
- ("wirewatch-unaggregation"),
-
- TALER_TESTING_cmd_check_bank_transfer
- ("check_bank_transfer-unaggregation",
- EXCHANGE_URL,
- "EUR:5.01",
- USER_ACCOUNT_NO,
- EXCHANGE_ACCOUNT_NO),
-
- TALER_TESTING_cmd_withdraw_amount
- ("withdraw-coin-unaggregation",
- is->exchange,
- "create-reserve-unaggregation",
- "EUR:5",
- MHD_HTTP_OK),
-
- TALER_TESTING_cmd_proposal
- ("create-proposal-unaggregation",
- merchant_url,
- is->ctx,
- MHD_HTTP_OK,
- "{\"max_fee\":\
- {\"currency\":\"EUR\",\
- \"value\":0,\
- \"fraction\":50000000},\
- \"refund_deadline\":\"\\/Date(2)\\/\",\
- \"pay_deadline\":\"\\/Date(1)\\/\",\
- \"wire_transfer_delay\":\"\\/Delay(30000)\\/\",\
- \"amount\":\
- {\"currency\":\"EUR\",\
- \"value\":5,\
- \"fraction\":0},\
- \"summary\": \"unaggregated product\",\
- \"fulfillment_url\": \"https://example.com/\",\
- \"products\": [ {\"description\":\"unaggregated cream\",\
- \"value\":\"{EUR:5}\"} ] }",
- NULL),
-
- TALER_TESTING_cmd_pay
- ("pay-unaggregation",
- merchant_url,
- is->ctx,
- MHD_HTTP_OK,
- "create-proposal-unaggregation",
- "withdraw-coin-unaggregation",
- "EUR:5", // amount + fee
- "EUR:4.99", // amount - fee
- "EUR:0.01"), // refund fee
-
- CMD_EXEC_AGGREGATOR
- ("aggregation-attempt"),
-
- TALER_TESTING_cmd_check_bank_empty
- ("check_bank_unaggregated"),
-
- #endif /* end of, HAVE_TWISTER */
-
- TALER_TESTING_cmd_end ()
- };
-
struct TALER_TESTING_Command track[] = {
TALER_TESTING_cmd_merchant_track_transaction
@@ -1123,9 +1050,6 @@ run (void *cls,
TALER_TESTING_cmd_batch ("double-spending",
double_spending),
- TALER_TESTING_cmd_batch ("unaggregation",
- unaggregation),
-
TALER_TESTING_cmd_batch ("track",
track),
diff --git a/src/lib/test_merchant_api_twisted.c b/src/lib/test_merchant_api_twisted.c
index 61dda110..73c6a54d 100644
--- a/src/lib/test_merchant_api_twisted.c
+++ b/src/lib/test_merchant_api_twisted.c
@@ -473,6 +473,83 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
+ /**
+ * This block tests whether a refund_deadline and/or
+ * wire_transfer_deadline very far in the future do NOT
+ * result in any wire transfer from the aggregator (#5366).
+ */
+ struct TALER_TESTING_Command unaggregation[] = {
+
+ CMD_TRANSFER_TO_EXCHANGE
+ ("create-reserve-unaggregation",
+ "EUR:5.01"),
+
+ CMD_EXEC_WIREWATCH
+ ("wirewatch-unaggregation"),
+
+ TALER_TESTING_cmd_check_bank_transfer
+ ("check_bank_transfer-unaggregation",
+ EXCHANGE_URL,
+ "EUR:5.01",
+ USER_ACCOUNT_NO,
+ EXCHANGE_ACCOUNT_NO),
+
+ TALER_TESTING_cmd_check_bank_empty
+ ("check_bank_unaggregated-a"),
+
+ TALER_TESTING_cmd_withdraw_amount
+ ("withdraw-coin-unaggregation",
+ is->exchange,
+ "create-reserve-unaggregation",
+ "EUR:5",
+ MHD_HTTP_OK),
+
+ TALER_TESTING_cmd_proposal
+ ("create-proposal-unaggregation",
+ twister_merchant_url,
+ is->ctx,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\
+ {\"currency\":\"EUR\",\
+ \"value\":0,\
+ \"fraction\":50000000},\
+ \"refund_deadline\":\"\\/Date(2)\\/\",\
+ \"pay_deadline\":\"\\/Date(1)\\/\",\
+ \"wire_transfer_delay\":\"\\/Delay(30000)\\/\",\
+ \"amount\":\
+ {\"currency\":\"EUR\",\
+ \"value\":5,\
+ \"fraction\":0},\
+ \"summary\": \"unaggregated product\",\
+ \"fulfillment_url\": \"https://example.com/\",\
+ \"products\": [ {\"description\":\"unaggregated cream\",\
+ \"value\":\"{EUR:5}\"} ] }",
+ /* Need a fresh instance in order to associate this
+ * proposal with a fresh h_wire; this way, this proposal
+ * won't get hooked by the aggregator gathering same-H_wire'd
+ * transactions. */
+ "tor"),
+
+ TALER_TESTING_cmd_pay
+ ("pay-unaggregation",
+ merchant_url,
+ is->ctx,
+ MHD_HTTP_OK,
+ "create-proposal-unaggregation",
+ "withdraw-coin-unaggregation",
+ "EUR:5", // amount + fee
+ "EUR:4.99", // amount - fee
+ "EUR:0.01"), // refund fee
+
+ CMD_EXEC_AGGREGATOR
+ ("aggregation-attempt"),
+
+ TALER_TESTING_cmd_check_bank_empty
+ ("check_bank_unaggregated-b"),
+
+ TALER_TESTING_cmd_end ()
+ };
+
/***** Test transactions tracking *****/
struct TALER_TESTING_Command track[] = {
@@ -493,6 +570,9 @@ run (void *cls,
EXCHANGE_URL,
"EUR:2.02", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO),
+ TALER_TESTING_cmd_check_bank_empty
+ ("track_chunk_check_empty-a"),
+
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1",
is->exchange,
"create-reserve-1",
@@ -808,6 +888,9 @@ run (void *cls,
TALER_TESTING_cmd_batch ("history",
history),
+ TALER_TESTING_cmd_batch ("unaggregation",
+ unaggregation),
+
TALER_TESTING_cmd_batch ("track",
track),
diff --git a/src/lib/testing_api_cmd_proposal.c b/src/lib/testing_api_cmd_proposal.c
index a558fa45..9a947d9d 100644
--- a/src/lib/testing_api_cmd_proposal.c
+++ b/src/lib/testing_api_cmd_proposal.c
@@ -322,7 +322,7 @@ proposal_cb (void *cls,
(ps->ctx,
ps->merchant_url,
ps->order_id,
- "default",
+ ps->instance,
&ps->nonce,
&proposal_lookup_initial_cb,
ps)))
@@ -493,7 +493,7 @@ TALER_TESTING_cmd_proposal (const char *label,
ps->http_status = http_status;
ps->ctx = ctx;
ps->merchant_url = merchant_url;
- ps->instance = instance;
+ ps->instance = (NULL == instance) ? "default": instance;
cmd.cls = ps;
cmd.label = label;