From 3b5d9daca9a621bd85778a7ad271a9d594dae0dd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 17 May 2022 11:46:41 +0200 Subject: -expand test to include coin refund --- src/testing/test_exchange_p2p.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src/testing') diff --git a/src/testing/test_exchange_p2p.c b/src/testing/test_exchange_p2p.c index ec3c660c4..a20649f4d 100644 --- a/src/testing/test_exchange_p2p.c +++ b/src/testing/test_exchange_p2p.c @@ -281,7 +281,7 @@ run (void *cls, TALER_TESTING_cmd_purse_create_with_reserve ( "purse-create-with-reserve-expire", MHD_HTTP_OK, - "{\"amount\":\"EUR:1\",\"summary\":\"ice cream\"}", + "{\"amount\":\"EUR:2\",\"summary\":\"ice cream\"}", true /* upload contract */, GNUNET_TIME_relative_multiply ( GNUNET_TIME_UNIT_SECONDS, @@ -312,6 +312,20 @@ run (void *cls, "EUR:1", true, GNUNET_TIME_UNIT_MINUTES), + /* This should fail, as too much of the coin + is already spend / in a purse */ + TALER_TESTING_cmd_purse_create_with_deposit ( + "purse-with-deposit-overspending", + MHD_HTTP_CONFLICT, + "{\"amount\":\"EUR:2\",\"summary\":\"ice cream\"}", + true, /* upload contract */ + GNUNET_TIME_relative_multiply ( + GNUNET_TIME_UNIT_SECONDS, + 1), /* expiration */ + "withdraw-coin-1", + "EUR:2.01", + NULL), + TALER_TESTING_cmd_sleep ("sleep", 2 /* seconds */), TALER_TESTING_cmd_exec_expire ("exec-expire", @@ -328,7 +342,22 @@ run (void *cls, GNUNET_TIME_UNIT_SECONDS, 15), "pull-poll-purse-before-expire"), - // FIXME: check coin was refunded + /* coin was refunded, so now this should be OK */ + /* This should fail, as too much of the coin + is already spend / in a purse */ + TALER_TESTING_cmd_purse_create_with_deposit ( + "purse-with-deposit-refunded", + MHD_HTTP_OK, + "{\"amount\":\"EUR:2\",\"summary\":\"ice cream\"}", + true, /* upload contract */ + GNUNET_TIME_relative_multiply ( + GNUNET_TIME_UNIT_SECONDS, + 1), /* expiration */ + "withdraw-coin-1", + "EUR:2.01", + NULL), + + // FIXME: check reserve purse capacity is back up! TALER_TESTING_cmd_end () }; -- cgit v1.2.3