diff options
Diffstat (limited to 'src/testing/test_kyc_api.c')
-rw-r--r-- | src/testing/test_kyc_api.c | 151 |
1 files changed, 55 insertions, 96 deletions
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c index 12f695690..0844c5818 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 @@ -57,7 +53,7 @@ static struct TALER_TESTING_BankConfiguration bc; * @param label label to use for the command. */ #define CMD_EXEC_WIREWATCH(label) \ - TALER_TESTING_cmd_exec_wirewatch (label, CONFIG_FILE) + TALER_TESTING_cmd_exec_wirewatch2 (label, CONFIG_FILE, "exchange-account-2") /** * Execute the taler-exchange-aggregator, closer and transfer commands 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", @@ -188,7 +184,10 @@ run (void *cls, "kyc-provider-test-oauth2", "bad", MHD_HTTP_FORBIDDEN), - TALER_TESTING_cmd_proof_kyc_oauth2 ("proof-kyc-fail", + TALER_TESTING_cmd_check_kyc_get ("check-kyc-deposit-again", + "track-deposit-kyc-ready", + MHD_HTTP_ACCEPTED), + TALER_TESTING_cmd_proof_kyc_oauth2 ("proof-kyc-pass", "track-deposit-kyc-ready", "kyc-provider-test-oauth2", "pass", @@ -196,17 +195,15 @@ 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 () }; struct TALER_TESTING_Command wallet_kyc[] = { - TALER_TESTING_cmd_oauth ("start-oauth-service", - 6666), TALER_TESTING_cmd_wallet_kyc_get ("wallet-kyc-fail", NULL, "EUR:1000000", @@ -255,13 +252,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 @@ -298,6 +295,10 @@ run (void *cls, "p2p_withdraw-coin-1", "EUR:1.01", NULL), + TALER_TESTING_cmd_coin_history ("coin-history-purse-with-deposit", + "p2p_withdraw-coin-1#0", + "EUR:3.99", + MHD_HTTP_OK), TALER_TESTING_cmd_purse_poll ( "push-poll-purse-before-merge", MHD_HTTP_OK, @@ -339,7 +340,7 @@ run (void *cls, "p2p_create-reserve-1", "EUR:1.03", MHD_HTTP_OK), - TALER_TESTING_cmd_reserve_status ( + TALER_TESTING_cmd_reserve_history ( "push-check-post-merge-reserve-balance-post", "p2p_create-reserve-1", "EUR:1.03", @@ -392,6 +393,10 @@ run (void *cls, "p2p_withdraw-coin-1", "EUR:1.01", NULL), + TALER_TESTING_cmd_coin_history ("coin-history-purse-pull-deposit", + "p2p_withdraw-coin-1#0", + "EUR:2.98", + MHD_HTTP_OK), TALER_TESTING_cmd_purse_poll_finish ( "pull-deposit-purse-poll-finish", GNUNET_TIME_relative_multiply ( @@ -399,14 +404,14 @@ run (void *cls, 5), "pull-poll-purse-before-deposit"), TALER_TESTING_cmd_status ( - "pull-check-post-merge-reserve-balance-get", + "pull-check-post-merge-reserve-balance-get-2", "p2p_create-reserve-3", - "EUR:1.02", + "EUR:1.03", MHD_HTTP_OK), - TALER_TESTING_cmd_reserve_status ( - "push-check-post-merge-reserve-balance-post", + TALER_TESTING_cmd_reserve_history ( + "push-check-post-merge-reserve-balance-post-2", "p2p_create-reserve-3", - "EUR:1.02", + "EUR:1.03", MHD_HTTP_OK), TALER_TESTING_cmd_end () }; @@ -518,29 +523,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, + NULL, + true, + true), TALER_TESTING_cmd_batch ("withdraw", withdraw), TALER_TESTING_cmd_batch ("spend", @@ -563,9 +557,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 +567,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); } |