diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-07-10 23:09:46 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-07-10 23:09:46 +0200 |
commit | 7085cfef70889a11508cdac4cd887b9959f59218 (patch) | |
tree | 610af337a248c92981ab6bf62697ee3e7d5a91e8 /src/testing/test_exchange_api.c | |
parent | ddf95c491af05732220ac35c6fb1bea48e6f4050 (diff) |
test coin_priv re-use with deposit and refresh, update handling of the error code client-side
Diffstat (limited to 'src/testing/test_exchange_api.c')
-rw-r--r-- | src/testing/test_exchange_api.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c index 410c1a492..75e3d480f 100644 --- a/src/testing/test_exchange_api.c +++ b/src/testing/test_exchange_api.c @@ -136,12 +136,12 @@ run (void *cls, * Do another transfer to the same reserve */ TALER_TESTING_cmd_admin_add_incoming_with_ref ("create-reserve-1.2", - "EUR:1", + "EUR:2.01", &bc.exchange_auth, bc.user42_payto, "create-reserve-1"), TALER_TESTING_cmd_check_bank_admin_transfer ("check-create-reserve-1.2", - "EUR:1", + "EUR:2.01", bc.user42_payto, bc.exchange_payto, "create-reserve-1.2"), @@ -154,12 +154,28 @@ run (void *cls, "EUR:5", MHD_HTTP_OK), /** + * Withdraw EUR:1 using the SAME private coin key as for the previous coin + * (in violation of the specification, to be detected on spending!). + */ + TALER_TESTING_cmd_withdraw_amount_reuse_key ("withdraw-coin-1x", + "create-reserve-1", + "EUR:1", + "withdraw-coin-1", + MHD_HTTP_OK), + /** * Check the reserve is depleted. */ TALER_TESTING_cmd_status ("status-1", "create-reserve-1", "EUR:0", MHD_HTTP_OK), + /* + * Try to overdraw. + */ + TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-2", + "create-reserve-1", + "EUR:5", + MHD_HTTP_CONFLICT), TALER_TESTING_cmd_end () }; @@ -178,13 +194,14 @@ run (void *cls, TALER_TESTING_cmd_deposit_replay ("deposit-simple-replay", "deposit-simple", MHD_HTTP_OK), - /* - * Try to overdraw. - */ - TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-2", - "create-reserve-1", - "EUR:5", - MHD_HTTP_CONFLICT), + TALER_TESTING_cmd_deposit ("deposit-reused-coin-key-failure", + "withdraw-coin-1x", + 0, + bc.user42_payto, + "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", + GNUNET_TIME_UNIT_ZERO, + "EUR:1", + MHD_HTTP_CONFLICT), /** * Try to double spend using different wire details. */ @@ -225,6 +242,14 @@ run (void *cls, }; struct TALER_TESTING_Command refresh[] = { + /** + * Try to melt the coin that shared the private key with another + * coin (should fail). */ + TALER_TESTING_cmd_melt ("refresh-melt-reused-coin-key-failure", + "withdraw-coin-1x", + MHD_HTTP_CONFLICT, + NULL), + /* Fill reserve with EUR:5, 1ct is for fees. */ CMD_TRANSFER_TO_EXCHANGE ("refresh-create-reserve-1", "EUR:5.01"), |