test case fixes

This commit is contained in:
Christian Grothoff 2020-01-15 16:00:43 +01:00
parent 3b13aaf844
commit e5078fcfe8
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 67 additions and 92 deletions

View File

@ -87,6 +87,7 @@ libtalertesting_la_SOURCES = \
testing_api_cmd_auditor_exec_wire_auditor.c \ testing_api_cmd_auditor_exec_wire_auditor.c \
testing_api_cmd_bank_admin_add_incoming.c \ testing_api_cmd_bank_admin_add_incoming.c \
testing_api_cmd_bank_check.c \ testing_api_cmd_bank_check.c \
testing_api_cmd_bank_admin_check.c \
testing_api_cmd_bank_check_empty.c \ testing_api_cmd_bank_check_empty.c \
testing_api_cmd_bank_history_credit.c \ testing_api_cmd_bank_history_credit.c \
testing_api_cmd_bank_history_debit.c \ testing_api_cmd_bank_history_debit.c \

View File

@ -121,6 +121,10 @@ run (void *cls,
*/ */
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-1", CMD_TRANSFER_TO_EXCHANGE ("create-reserve-1",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer
("check-create-reserve-1",
"EUR:5.01", bc.user42_payto, bc.exchange_payto,
"create-reserve-1"),
/** /**
* Make a reserve exist, according to the previous * Make a reserve exist, according to the previous
* transfer. * transfer.
@ -199,15 +203,16 @@ run (void *cls,
struct TALER_TESTING_Command refresh[] = { struct TALER_TESTING_Command refresh[] = {
/* Fill reserve with EUR:5, 1ct is for fees. NOTE: the old
/**
* Fill reserve with EUR:5, 1ct is for fees. NOTE: the old
* test-suite gave a account number of _424_ to the user at * test-suite gave a account number of _424_ to the user at
* this step; to type less, here the _42_ number is reused. * this step; to type less, here the _42_ number is reused.
* Does this change the tests semantics? * Does this change the tests semantics? */
*/CMD_TRANSFER_TO_EXCHANGE ("refresh-create-reserve-1", CMD_TRANSFER_TO_EXCHANGE ("refresh-create-reserve-1",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer
("check-refresh-create-reserve-1",
"EUR:5.01", bc.user42_payto, bc.exchange_payto,
"refresh-create-reserve-1"),
/** /**
* Make previous command effective. * Make previous command effective.
*/ */
@ -351,20 +356,6 @@ run (void *cls,
("check_bank_transfer-99c", ec.exchange_url, ("check_bank_transfer-99c", ec.exchange_url,
"EUR:0.08", bc.exchange_payto, bc.user43_payto), "EUR:0.08", bc.exchange_payto, bc.user43_payto),
TALER_TESTING_cmd_check_bank_admin_transfer
("check_bank_transfer-aai-1",
"EUR:5.01", bc.user42_payto, bc.exchange_payto,
"FIXME"),
/**
* NOTE: the old test-suite had this "check bank transfer"
* command with debit account == 424.
*/
TALER_TESTING_cmd_check_bank_admin_transfer
("check_bank_transfer-aai-2", ec.exchange_url,
"EUR:5.01", bc.user42_payto, bc.exchange_payto,
"FIXME"),
TALER_TESTING_cmd_check_bank_empty ("check_bank_empty"), TALER_TESTING_cmd_check_bank_empty ("check_bank_empty"),
TALER_TESTING_cmd_track_transaction TALER_TESTING_cmd_track_transaction
@ -390,28 +381,19 @@ run (void *cls,
* very far in the future does NOT get aggregated now. * very far in the future does NOT get aggregated now.
*/ */
struct TALER_TESTING_Command unaggregation[] = { struct TALER_TESTING_Command unaggregation[] = {
TALER_TESTING_cmd_check_bank_empty ("far-future-aggregation-a"),
TALER_TESTING_cmd_check_bank_empty
("far-future-aggregation-a"),
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-unaggregated", CMD_TRANSFER_TO_EXCHANGE ("create-reserve-unaggregated",
"EUR:5.01"), "EUR:5.01"),
CMD_EXEC_WIREWATCH ("wirewatch-unaggregated"),
/* "consume" reserve creation transfer. */ /* "consume" reserve creation transfer. */
TALER_TESTING_cmd_check_bank_transfer TALER_TESTING_cmd_check_bank_admin_transfer
("check_bank_transfer-unaggregated", ("check-create-reserve-unaggregated",
ec.exchange_url, "EUR:5.01", bc.user42_payto, bc.exchange_payto,
"EUR:5.01", "create-reserve-unaggregated"),
bc.user42_payto, bc.exchange_payto), CMD_EXEC_WIREWATCH ("wirewatch-unaggregated"),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-unaggregated",
TALER_TESTING_cmd_withdraw_amount "create-reserve-unaggregated",
("withdraw-coin-unaggregated", "EUR:5",
"create-reserve-unaggregated", MHD_HTTP_OK),
"EUR:5",
MHD_HTTP_OK),
TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit
("deposit-unaggregated", ("deposit-unaggregated",
"withdraw-coin-unaggregated", "withdraw-coin-unaggregated",
@ -441,7 +423,10 @@ run (void *cls,
*/ */
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-r1", CMD_TRANSFER_TO_EXCHANGE ("create-reserve-r1",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer
("check-create-reserve-r1",
"EUR:5.01", bc.user42_payto, bc.exchange_payto,
"create-reserve-r1"),
/** /**
* Run wire-watch to trigger the reserve creation. * Run wire-watch to trigger the reserve creation.
@ -471,16 +456,11 @@ run (void *cls,
*/ */
CMD_EXEC_AGGREGATOR ("run-aggregator-refund"), CMD_EXEC_AGGREGATOR ("run-aggregator-refund"),
/** /* Check that aggregator didn't do anything, as expected.
* Check that aggregator didn't do anything, as expected.
* Note, this operation takes two commands: one to "flush" * Note, this operation takes two commands: one to "flush"
* the preliminary transfer (used to withdraw) from the * the preliminary transfer (used to withdraw) from the
* fakebank and the second to actually check there are not * fakebank and the second to actually check there are not
* other transfers around. * other transfers around. *///
*/TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-pre-refund", ec.exchange_url,
"EUR:5.01", bc.user42_payto, bc.exchange_payto),
TALER_TESTING_cmd_check_bank_empty TALER_TESTING_cmd_check_bank_empty
("check_bank_transfer-pre-refund"), ("check_bank_transfer-pre-refund"),
@ -538,20 +518,16 @@ run (void *cls,
*/ */
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-rb", CMD_TRANSFER_TO_EXCHANGE ("create-reserve-rb",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer
("check-create-reserve-rb",
"EUR:5.01", bc.user42_payto, bc.exchange_payto,
"create-reserve-rb"),
CMD_EXEC_WIREWATCH ("wirewatch-rb"), CMD_EXEC_WIREWATCH ("wirewatch-rb"),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-rb", TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-rb",
"create-reserve-rb", "create-reserve-rb",
"EUR:5", "EUR:5",
MHD_HTTP_OK), MHD_HTTP_OK),
TALER_TESTING_cmd_check_bank_admin_transfer
("check_bank_transfer-aai-3b",
"EUR:5.01", bc.user42_payto, bc.exchange_payto,
"FIXME"),
TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit
("deposit-refund-1b", "withdraw-coin-rb", 0, ("deposit-refund-1b", "withdraw-coin-rb", 0,
bc.user42_payto, bc.user42_payto,
@ -587,7 +563,10 @@ run (void *cls,
*/ */
CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-1", CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-1",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer
("payback-create-reserve-1",
"EUR:5.01", bc.user42_payto, bc.exchange_payto,
"payback-create-reserve-1"),
/** /**
* Run wire-watch to trigger the reserve creation. * Run wire-watch to trigger the reserve creation.
*/ */
@ -638,13 +617,16 @@ run (void *cls,
"EUR:3.99", "EUR:3.99",
MHD_HTTP_OK), MHD_HTTP_OK),
/** /* These commands should close the reserve because
* These commands should close the reserve because
* the aggregator is given a config file that ovverrides * the aggregator is given a config file that ovverrides
* the reserve expiration time (making it now-ish) * the reserve expiration time (making it now-ish) */
*/CMD_TRANSFER_TO_EXCHANGE CMD_TRANSFER_TO_EXCHANGE
("short-lived-reserve", ("short-lived-reserve",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer
("check-short-lived-reserve",
"EUR:5.01", bc.user42_payto, bc.exchange_payto,
"short-lived-reserve"),
TALER_TESTING_cmd_exec_wirewatch TALER_TESTING_cmd_exec_wirewatch
("short-lived-aggregation", ("short-lived-aggregation",
@ -664,29 +646,22 @@ run (void *cls,
"short-lived-reserve", "short-lived-reserve",
"EUR:1", "EUR:1",
MHD_HTTP_CONFLICT), MHD_HTTP_CONFLICT),
TALER_TESTING_cmd_check_bank_transfer ("check_bank_short-lived_reimburse",
TALER_TESTING_cmd_check_bank_transfer ec.exchange_url,
("check_bank_short-lived_transfer", "EUR:5",
ec.exchange_url, bc.exchange_payto,
"EUR:5.01", bc.user42_payto),
bc.user42_payto, /* Fill reserve with EUR:2.02, as withdraw fee is 1 ct per
bc.exchange_payto),
TALER_TESTING_cmd_check_bank_transfer
("check_bank_short-lived_reimburse",
ec.exchange_url,
"EUR:5",
bc.exchange_payto,
bc.user42_payto),
/**
* Fill reserve with EUR:2.02, as withdraw fee is 1 ct per
* config, then withdraw two coin, partially spend one, and * config, then withdraw two coin, partially spend one, and
* then have the rest paid back. Check deposit of other coin * then have the rest paid back. Check deposit of other coin
* fails. (Do not use EUR:5 here as the EUR:5 coin was * fails. Do not use EUR:5 here as the EUR:5 coin was
* revoked and we did not bother to create a new one...) * revoked and we did not bother to create a new one... *///
*/CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-2", CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-2",
"EUR:2.02"), "EUR:2.02"),
TALER_TESTING_cmd_check_bank_admin_transfer
("check-payback-create-reserve-2",
"EUR:2.02", bc.user42_payto, bc.exchange_payto,
"payback-create-reserve-2"),
/* Make previous command effective. */ /* Make previous command effective. */
CMD_EXEC_WIREWATCH ("wirewatch-5"), CMD_EXEC_WIREWATCH ("wirewatch-5"),
@ -751,6 +726,10 @@ run (void *cls,
/* Test that revoked coins cannot be withdrawn */ /* Test that revoked coins cannot be withdrawn */
CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-3", CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-3",
"EUR:1.01"), "EUR:1.01"),
TALER_TESTING_cmd_check_bank_admin_transfer
("check-payback-create-reserve-3",
"EUR:1.01", bc.user42_payto, bc.exchange_payto,
"payback-create-reserve-3"),
CMD_EXEC_WIREWATCH ("wirewatch-6"), CMD_EXEC_WIREWATCH ("wirewatch-6"),
@ -761,15 +740,6 @@ run (void *cls,
MHD_HTTP_NOT_FOUND), MHD_HTTP_NOT_FOUND),
/* check that we are empty before the rejection test */ /* check that we are empty before the rejection test */
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-pr1", ec.exchange_url,
"EUR:5.01", bc.user42_payto, bc.exchange_payto),
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-pr2", ec.exchange_url,
"EUR:2.02", bc.user42_payto, bc.exchange_payto),
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-pr3", ec.exchange_url,
"EUR:1.01", bc.user42_payto, bc.exchange_payto),
TALER_TESTING_cmd_check_bank_empty TALER_TESTING_cmd_check_bank_empty
("check-empty-again"), ("check-empty-again"),
@ -783,6 +753,10 @@ run (void *cls,
*/ */
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-1", CMD_TRANSFER_TO_EXCHANGE ("create-reserve-1",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer
("check-create-reserve-1",
"EUR:5.01", bc.user42_payto, bc.exchange_payto,
"create-reserve-1"),
/** /**
* Run wire-watch to trigger the reserve creation. * Run wire-watch to trigger the reserve creation.
*/ */

View File

@ -81,7 +81,7 @@ check_bank_admin_transfer_run (void *cls,
char *credit_account; char *credit_account;
const char *debit_payto; const char *debit_payto;
const char *credit_payto; const char *credit_payto;
const struct TALER_ReservePublicKeyP *reserve_pubp; const struct TALER_ReservePublicKeyP *reserve_pub;
const struct TALER_TESTING_Command *cmd_ref; const struct TALER_TESTING_Command *cmd_ref;
cmd_ref cmd_ref
@ -96,7 +96,7 @@ check_bank_admin_transfer_run (void *cls,
if (GNUNET_OK != if (GNUNET_OK !=
TALER_TESTING_get_trait_reserve_pub (cmd_ref, TALER_TESTING_get_trait_reserve_pub (cmd_ref,
0, 0,
&reserve_pubp)) &reserve_pub))
{ {
GNUNET_break (0); GNUNET_break (0);
TALER_LOG_ERROR ("Command reference fails to provide reserve public key\n"); TALER_LOG_ERROR ("Command reference fails to provide reserve public key\n");
@ -169,11 +169,11 @@ check_bank_admin_transfer_traits (void *cls,
const char *trait, const char *trait,
unsigned int index) unsigned int index)
{ {
struct BankAdminCheckState *bcs = cls;
struct TALER_TESTING_Trait traits[] = { struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_trait_end () TALER_TESTING_trait_end ()
}; };
(void) cls;
return TALER_TESTING_get_trait (traits, return TALER_TESTING_get_trait (traits,
ret, ret,
trait, trait,