summaryrefslogtreecommitdiff
path: root/src/testing/test_kyc_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-06-07 23:11:05 +0200
committerChristian Grothoff <christian@grothoff.org>2023-06-07 23:11:05 +0200
commita2dde02b64a8ee75c9243632eb45a6ceb9b62dd5 (patch)
tree378cb6aefaf7f00894a7c8916fad9c3de84e31b4 /src/testing/test_kyc_api.c
parent015b08b0489d72f3fda587eec900bc4193a6a57e (diff)
downloadexchange-a2dde02b64a8ee75c9243632eb45a6ceb9b62dd5.tar.gz
exchange-a2dde02b64a8ee75c9243632eb45a6ceb9b62dd5.tar.bz2
exchange-a2dde02b64a8ee75c9243632eb45a6ceb9b62dd5.zip
major libtalertesting API refactoring, including no longer having taler-specific logic in the test engine core
Diffstat (limited to 'src/testing/test_kyc_api.c')
-rw-r--r--src/testing/test_kyc_api.c122
1 files changed, 36 insertions, 86 deletions
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c
index 12f695690..eb66d9c85 100644
--- a/src/testing/test_kyc_api.c
+++ b/src/testing/test_kyc_api.c
@@ -41,14 +41,10 @@
#define CONFIG_FILE "test_kyc_api.conf"
/**
- * Exchange configuration data.
+ * Our credentials.
*/
-static struct TALER_TESTING_ExchangeConfiguration ec;
+struct TALER_TESTING_Credentials cred;
-/**
- * Bank configuration data.
- */
-static struct TALER_TESTING_BankConfiguration bc;
/**
* Execute the taler-exchange-wirewatch command with
@@ -79,8 +75,8 @@ static struct TALER_TESTING_BankConfiguration bc;
*/
#define CMD_TRANSFER_TO_EXCHANGE(label,amount) \
TALER_TESTING_cmd_admin_add_incoming (label, amount, \
- &bc.exchange_auth, \
- bc.user42_payto)
+ &cred.ba, \
+ cred.user42_payto)
/**
* Main function that will tell the interpreter what commands to
@@ -98,8 +94,8 @@ run (void *cls,
TALER_TESTING_cmd_check_bank_admin_transfer (
"check-create-reserve-1",
"EUR:15.02",
- bc.user42_payto,
- bc.exchange_payto,
+ cred.user42_payto,
+ cred.exchange_payto,
"create-reserve-1"),
CMD_EXEC_WIREWATCH ("wirewatch-1"),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1-no-kyc",
@@ -150,7 +146,7 @@ run (void *cls,
"deposit-simple",
"withdraw-coin-1",
0,
- bc.user43_payto,
+ cred.user43_payto,
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO,
"EUR:5",
@@ -196,10 +192,10 @@ run (void *cls,
CMD_EXEC_AGGREGATOR ("run-aggregator-after-kyc"),
TALER_TESTING_cmd_check_bank_transfer (
"check_bank_transfer-499c",
- ec.exchange_url,
+ cred.exchange_url,
"EUR:4.98",
- bc.exchange_payto,
- bc.user43_payto),
+ cred.exchange_payto,
+ cred.user43_payto),
TALER_TESTING_cmd_check_bank_empty ("check_bank_empty"),
TALER_TESTING_cmd_end ()
};
@@ -255,13 +251,13 @@ run (void *cls,
MHD_HTTP_OK),
TALER_TESTING_cmd_check_bank_admin_transfer ("p2p_check-create-reserve-1",
"EUR:5.04",
- bc.user42_payto,
- bc.exchange_payto,
+ cred.user42_payto,
+ cred.exchange_payto,
"p2p_create-reserve-1"),
TALER_TESTING_cmd_check_bank_admin_transfer ("p2p_check-create-reserve-2",
"EUR:5.01",
- bc.user42_payto,
- bc.exchange_payto,
+ cred.user42_payto,
+ cred.exchange_payto,
"p2p_create-reserve-2"),
/**
* Make a reserve exist, according to the previous
@@ -518,29 +514,18 @@ run (void *cls,
};
struct TALER_TESTING_Command commands[] = {
- TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees",
- CONFIG_FILE,
- "EUR:0.01",
- "EUR:0.01"),
- TALER_TESTING_cmd_exec_offline_sign_global_fees ("offline-sign-global-fees",
- CONFIG_FILE,
- "EUR:0.01",
- "EUR:0.01",
- "EUR:0.01",
- GNUNET_TIME_UNIT_MINUTES,
- GNUNET_TIME_UNIT_DAYS,
- 1),
- TALER_TESTING_cmd_auditor_add ("add-auditor-OK",
- MHD_HTTP_NO_CONTENT,
- false),
- TALER_TESTING_cmd_wire_add ("add-wire-account",
- "payto://x-taler-bank/localhost/2?receiver-name=2",
- MHD_HTTP_NO_CONTENT,
- false),
- TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys",
- CONFIG_FILE),
- TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys",
- 2),
+ TALER_TESTING_cmd_run_fakebank ("run-fakebank",
+ cred.cfg,
+ "exchange-account-2"),
+ TALER_TESTING_cmd_system_start ("start-taler",
+ CONFIG_FILE,
+ "-e",
+ NULL),
+ TALER_TESTING_cmd_get_exchange ("get-exchange",
+ cred.cfg,
+ true,
+ true),
+ TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
TALER_TESTING_cmd_batch ("withdraw",
withdraw),
TALER_TESTING_cmd_batch ("spend",
@@ -563,9 +548,8 @@ run (void *cls,
};
(void) cls;
- TALER_TESTING_run_with_fakebank (is,
- commands,
- bc.exchange_auth.wire_gateway_url);
+ TALER_TESTING_run (is,
+ commands);
}
@@ -574,48 +558,14 @@ main (int argc,
char *const *argv)
{
(void) argc;
- (void) argv;
- /* These environment variables get in the way... */
- unsetenv ("XDG_DATA_HOME");
- unsetenv ("XDG_CONFIG_HOME");
- GNUNET_log_setup ("test-kyc-api",
- "INFO",
- NULL);
- /* Check fakebank port is available and get configuration data. */
- if (GNUNET_OK !=
- TALER_TESTING_prepare_fakebank (CONFIG_FILE,
- "exchange-account-2",
- &bc))
- return 77;
- TALER_TESTING_cleanup_files (CONFIG_FILE);
- /* @helpers. Run keyup, create tables, ... Note: it
- * fetches the port number from config in order to see
- * if it's available. */
- switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
- GNUNET_YES,
- &ec))
- {
- case GNUNET_SYSERR:
- GNUNET_break (0);
- return 1;
- case GNUNET_NO:
- return 77;
- case GNUNET_OK:
- if (GNUNET_OK !=
- /* Set up event loop and reschedule context, plus
- * start/stop the exchange. It calls TALER_TESTING_setup
- * which creates the 'is' object.
- */
- TALER_TESTING_setup_with_exchange (&run,
- NULL,
- CONFIG_FILE))
- return 1;
- break;
- default:
- GNUNET_break (0);
- return 1;
- }
- return 0;
+ return TALER_TESTING_main (argv,
+ "INFO",
+ CONFIG_FILE,
+ "exchange-account-2",
+ TALER_TESTING_BS_FAKEBANK,
+ &cred,
+ &run,
+ NULL);
}