aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Blättler <blatc2@bfh.ch>2024-06-06 09:15:40 +0200
committerChristian Blättler <blatc2@bfh.ch>2024-06-06 09:15:40 +0200
commit1c42a82671cbc792a47d4ae7b86aee339dee2041 (patch)
tree2e2bb90dfca73bb8c7c1e5adfcf166e7a1515b3d
parent44ef77be8ce3ae7bb89f3c10a4f864981f1d0481 (diff)
add test for double-spending a token
-rw-r--r--src/lib/merchant_api_post_order_pay.c5
-rw-r--r--src/testing/test_merchant_api.c27
-rw-r--r--src/testing/testing_api_cmd_pay_order.c2
3 files changed, 25 insertions, 9 deletions
diff --git a/src/lib/merchant_api_post_order_pay.c b/src/lib/merchant_api_post_order_pay.c
index ca4e8a18..33592c08 100644
--- a/src/lib/merchant_api_post_order_pay.c
+++ b/src/lib/merchant_api_post_order_pay.c
@@ -396,11 +396,6 @@ TALER_MERCHANT_order_pay_frontend (
struct TALER_Amount total_fee;
struct TALER_Amount total_amount;
- if (0 == num_coins)
- {
- GNUNET_break (0);
- return NULL;
- }
j_coins = json_array ();
GNUNET_assert (NULL != j_coins);
for (unsigned int i = 0; i<num_coins; i++)
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 9e9025ed..4ac4d96a 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -1729,9 +1729,30 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
"create-order-with-input-and-output",
- "withdraw-coin-2",
- "EUR:5",
- "EUR:4.99",
+ "",
+ "EUR:0",
+ "EUR:0",
+ NULL,
+ 0,
+ "pay-order-with-output"),
+ TALER_TESTING_cmd_merchant_post_orders_choices ("create-another-order-with-input-and-output",
+ cred.cfg,
+ merchant_url,
+ MHD_HTTP_OK,
+ "create-tokenfamily",
+ 1,
+ 1,
+ "5-input-output-2",
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
+ "EUR:0.0"),
+ TALER_TESTING_cmd_merchant_pay_order_choices ("double-spend-token",
+ merchant_url,
+ MHD_HTTP_CONFLICT,
+ "create-another-order-with-input-and-output",
+ "",
+ "EUR:0",
+ "EUR:0",
NULL,
0,
"pay-order-with-output"),
diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c
index a356d327..dbcb5b24 100644
--- a/src/testing/testing_api_cmd_pay_order.c
+++ b/src/testing/testing_api_cmd_pay_order.c
@@ -300,7 +300,7 @@ build_coins (struct TALER_MERCHANT_PayCoin **pc,
/* Token syntax is "LABEL[/NUMBER]" */
ctok = strchr (token, '/');
- // TODO: Check why this is not used?
+ // TODO: Check why ci variable is parsed but not used?
ci = 0;
if (NULL != ctok)
{