summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-06-26 12:09:05 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-06-26 12:09:05 +0200
commit8eb86b430e3276ba5246460d5c8832645134281d (patch)
treeb060dbf473343b9e244d474a8dc9bcd52ca41a19 /src/lib
parent963957e570ffd6c44c2cbca793000fe499c37694 (diff)
downloadmerchant-8eb86b430e3276ba5246460d5c8832645134281d.tar.gz
merchant-8eb86b430e3276ba5246460d5c8832645134281d.tar.bz2
merchant-8eb86b430e3276ba5246460d5c8832645134281d.zip
Splitting tests, up to tip
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/test_merchant_api_new.c69
-rw-r--r--src/lib/testing_api_cmd_tip.c9
2 files changed, 47 insertions, 31 deletions
diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c
index 706c36db..6787ebc5 100644
--- a/src/lib/test_merchant_api_new.c
+++ b/src/lib/test_merchant_api_new.c
@@ -628,35 +628,8 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
- struct TALER_TESTING_Command commands[] = {
- TALER_TESTING_cmd_batch ("pay",
- pay),
-
- TALER_TESTING_cmd_batch ("double-spending",
- double_spending),
-
- TALER_TESTING_cmd_batch ("track",
- track),
-
- /**
- * Just a weird /history request, not really tied to
- * any CMDs chunk.
- */
- TALER_TESTING_cmd_history
- ("history-2",
- merchant_url,
- is->ctx,
- MHD_HTTP_OK,
- GNUNET_TIME_absolute_add (GNUNET_TIME_UNIT_ZERO_ABS,
- GNUNET_TIME_UNIT_MICROSECONDS),
- /* zero results expected, time too ancient. */
- 0,
- 10,
- 10),
-
- TALER_TESTING_cmd_batch ("refund",
- refund),
+ struct TALER_TESTING_Command tip[] = {
/* Test tipping. */
TALER_TESTING_cmd_fakebank_transfer_with_instance
@@ -671,7 +644,6 @@ run (void *cls,
EXCHANGE_URL,
CONFIG_FILE),
-
CMD_EXEC_WIREWATCH ("wirewatch-3"),
TALER_TESTING_cmd_check_bank_transfer
@@ -697,7 +669,6 @@ run (void *cls,
"tip 2",
"EUR:5.01"),
-
/* This command tests the authorization of tip
* against a reserve that does not exist. This is
* implemented by passing a "tip instance" that
@@ -736,6 +707,44 @@ run (void *cls,
"authorize-tip-1",
pickup_amounts_1,
is->exchange),
+ TALER_TESTING_cmd_end ()
+ };
+
+ struct TALER_TESTING_Command commands[] = {
+
+ TALER_TESTING_cmd_batch ("pay",
+ pay),
+
+ TALER_TESTING_cmd_batch ("double-spending",
+ double_spending),
+
+ TALER_TESTING_cmd_batch ("track",
+ track),
+
+ /**
+ * Just a weird /history request, not really tied to
+ * any CMDs chunk.
+ */
+ TALER_TESTING_cmd_history
+ ("history-2",
+ merchant_url,
+ is->ctx,
+ MHD_HTTP_OK,
+ GNUNET_TIME_absolute_add (GNUNET_TIME_UNIT_ZERO_ABS,
+ GNUNET_TIME_UNIT_MICROSECONDS),
+ /* zero results expected, time too ancient. */
+ 0,
+ 10,
+ 10),
+
+ TALER_TESTING_cmd_batch ("refund",
+ refund),
+
+ TALER_TESTING_cmd_batch ("tip",
+ tip),
+
+
+
TALER_TESTING_cmd_tip_query_with_amounts ("query-tip-3",
merchant_url,
diff --git a/src/lib/testing_api_cmd_tip.c b/src/lib/testing_api_cmd_tip.c
index ec747fa7..f90afeb8 100644
--- a/src/lib/testing_api_cmd_tip.c
+++ b/src/lib/testing_api_cmd_tip.c
@@ -772,6 +772,11 @@ struct WithdrawHandle
*/
unsigned int off;
+
+ /**
+ * Internal state of the "pickup" CMD.
+ */
+ struct TipPickupState *tps;
};
/**
@@ -796,7 +801,8 @@ pickup_withdraw_cb (void *cls,
{
struct WithdrawHandle *wh = cls;
struct TALER_TESTING_Interpreter *is = wh->is;
- struct TipPickupState *tps = is->commands[is->ip].cls;
+
+ struct TipPickupState *tps = wh->tps;
wh->wsh = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -904,6 +910,7 @@ pickup_cb (void *cls,
wh->off = i;
wh->is = tps->is;
+ wh->tps = tps;
GNUNET_assert
( (NULL == wh->wsh) &&
( (NULL == tps->sigs) ||