diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-05-17 11:46:41 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-05-17 11:46:41 +0200 |
commit | 3b5d9daca9a621bd85778a7ad271a9d594dae0dd (patch) | |
tree | 9621f777e475da238bc0a663388f524d267b2690 /src/testing/test_exchange_p2p.c | |
parent | d8f1f7b761a41fc027c53dcd85c2b07dd73c6d1b (diff) | |
download | exchange-3b5d9daca9a621bd85778a7ad271a9d594dae0dd.tar.xz |
-expand test to include coin refund
Diffstat (limited to 'src/testing/test_exchange_p2p.c')
-rw-r--r-- | src/testing/test_exchange_p2p.c | 33 |
1 files changed, 31 insertions, 2 deletions
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 () }; |