Test cases connect to the exchange via the base URL

they get from exchange/BASE_URL config value.  This way, the
twister can be easily put in the middle by making it
listen on the same port specified after the : of the
exchange/BASE_URL.
This commit is contained in:
Marcello Stanisci 2018-02-28 16:59:39 +01:00
parent f1f5377003
commit a360d9c6a0
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
4 changed files with 23 additions and 28 deletions

View File

@ -2141,7 +2141,7 @@ interpreter_run (void *cls)
= TALER_BANK_admin_add_incoming (ctx, = TALER_BANK_admin_add_incoming (ctx,
"http://localhost:8082/", /* bank URL */ "http://localhost:8082/", /* bank URL */
&auth, &auth,
"https://exchange.com/", /* exchange URL */ "http://localhost:8081/", /* exchange URL */
subject, subject,
&amount, &amount,
cmd->details.admin_add_incoming.debit_account_no, cmd->details.admin_add_incoming.debit_account_no,
@ -3414,42 +3414,42 @@ run (void *cls)
{ .oc = OC_CHECK_BANK_TRANSFER, { .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-499c", .label = "check_bank_transfer-499c",
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/", .details.check_bank_transfer.exchange_base_url = "http://localhost:8081/",
.details.check_bank_transfer.amount = "EUR:4.98", .details.check_bank_transfer.amount = "EUR:4.98",
.details.check_bank_transfer.account_debit = 2, .details.check_bank_transfer.account_debit = 2,
.details.check_bank_transfer.account_credit = 42 .details.check_bank_transfer.account_credit = 42
}, },
{ .oc = OC_CHECK_BANK_TRANSFER, { .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-99c1", .label = "check_bank_transfer-99c1",
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/", .details.check_bank_transfer.exchange_base_url = "http://localhost:8081/",
.details.check_bank_transfer.amount = "EUR:0.98", .details.check_bank_transfer.amount = "EUR:0.98",
.details.check_bank_transfer.account_debit = 2, .details.check_bank_transfer.account_debit = 2,
.details.check_bank_transfer.account_credit = 42 .details.check_bank_transfer.account_credit = 42
}, },
{ .oc = OC_CHECK_BANK_TRANSFER, { .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-99c2", .label = "check_bank_transfer-99c2",
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/", .details.check_bank_transfer.exchange_base_url = "http://localhost:8081/",
.details.check_bank_transfer.amount = "EUR:0.98", .details.check_bank_transfer.amount = "EUR:0.98",
.details.check_bank_transfer.account_debit = 2, .details.check_bank_transfer.account_debit = 2,
.details.check_bank_transfer.account_credit = 42 .details.check_bank_transfer.account_credit = 42
}, },
{ .oc = OC_CHECK_BANK_TRANSFER, { .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-9c", .label = "check_bank_transfer-9c",
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/", .details.check_bank_transfer.exchange_base_url = "http://localhost:8081/",
.details.check_bank_transfer.amount = "EUR:0.08", .details.check_bank_transfer.amount = "EUR:0.08",
.details.check_bank_transfer.account_debit = 2, .details.check_bank_transfer.account_debit = 2,
.details.check_bank_transfer.account_credit = 43 .details.check_bank_transfer.account_credit = 43
}, },
{ .oc = OC_CHECK_BANK_TRANSFER, { .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-aai-1", .label = "check_bank_transfer-aai-1",
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/", .details.check_bank_transfer.exchange_base_url = "http://localhost:8081/",
.details.check_bank_transfer.amount = "EUR:5.01", .details.check_bank_transfer.amount = "EUR:5.01",
.details.check_bank_transfer.account_debit = 42, .details.check_bank_transfer.account_debit = 42,
.details.check_bank_transfer.account_credit = 2 .details.check_bank_transfer.account_credit = 2
}, },
{ .oc = OC_CHECK_BANK_TRANSFER, { .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-aai-2", .label = "check_bank_transfer-aai-2",
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/", .details.check_bank_transfer.exchange_base_url = "http://localhost:8081/",
.details.check_bank_transfer.amount = "EUR:5.01", .details.check_bank_transfer.amount = "EUR:5.01",
.details.check_bank_transfer.account_debit = 424, .details.check_bank_transfer.account_debit = 424,
.details.check_bank_transfer.account_credit = 2 .details.check_bank_transfer.account_credit = 2
@ -3516,7 +3516,7 @@ run (void *cls)
.label = "run-aggregator-refund" }, .label = "run-aggregator-refund" },
{ .oc = OC_CHECK_BANK_TRANSFER, { .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-aai-3", .label = "check_bank_transfer-aai-3",
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/", .details.check_bank_transfer.exchange_base_url = "http://localhost:8081/",
.details.check_bank_transfer.amount = "EUR:5.01", .details.check_bank_transfer.amount = "EUR:5.01",
.details.check_bank_transfer.account_debit = 42, .details.check_bank_transfer.account_debit = 42,
.details.check_bank_transfer.account_credit = 2 .details.check_bank_transfer.account_credit = 2
@ -3548,7 +3548,7 @@ run (void *cls)
/* Check that deposit did run */ /* Check that deposit did run */
{ .oc = OC_CHECK_BANK_TRANSFER, { .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-pre-refund", .label = "check_bank_transfer-pre-refund",
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/", .details.check_bank_transfer.exchange_base_url = "http://localhost:8081/",
.details.check_bank_transfer.amount = "EUR:4.97", .details.check_bank_transfer.amount = "EUR:4.97",
.details.check_bank_transfer.account_debit = 2, .details.check_bank_transfer.account_debit = 2,
.details.check_bank_transfer.account_credit = 42 .details.check_bank_transfer.account_credit = 42
@ -3597,7 +3597,7 @@ run (void *cls)
}, },
{ .oc = OC_CHECK_BANK_TRANSFER, { .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-aai-3b", .label = "check_bank_transfer-aai-3b",
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/", .details.check_bank_transfer.exchange_base_url = "http://localhost:8081/",
.details.check_bank_transfer.amount = "EUR:5.01", .details.check_bank_transfer.amount = "EUR:5.01",
.details.check_bank_transfer.account_debit = 42, .details.check_bank_transfer.account_debit = 42,
.details.check_bank_transfer.account_credit = 2 .details.check_bank_transfer.account_credit = 2
@ -3752,21 +3752,21 @@ run (void *cls)
/* check that we are empty before the rejection test */ /* check that we are empty before the rejection test */
{ .oc = OC_CHECK_BANK_TRANSFER, { .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-pr1", .label = "check_bank_transfer-pr1",
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/", .details.check_bank_transfer.exchange_base_url = "http://localhost:8081/",
.details.check_bank_transfer.amount = "EUR:5.01", .details.check_bank_transfer.amount = "EUR:5.01",
.details.check_bank_transfer.account_debit = 42, .details.check_bank_transfer.account_debit = 42,
.details.check_bank_transfer.account_credit = 2 .details.check_bank_transfer.account_credit = 2
}, },
{ .oc = OC_CHECK_BANK_TRANSFER, { .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-pr2", .label = "check_bank_transfer-pr2",
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/", .details.check_bank_transfer.exchange_base_url = "http://localhost:8081/",
.details.check_bank_transfer.amount = "EUR:2.02", .details.check_bank_transfer.amount = "EUR:2.02",
.details.check_bank_transfer.account_debit = 42, .details.check_bank_transfer.account_debit = 42,
.details.check_bank_transfer.account_credit = 2 .details.check_bank_transfer.account_credit = 2
}, },
{ .oc = OC_CHECK_BANK_TRANSFER, { .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-pr3", .label = "check_bank_transfer-pr3",
.details.check_bank_transfer.exchange_base_url = "https://exchange.com/", .details.check_bank_transfer.exchange_base_url = "http://localhost:8081/",
.details.check_bank_transfer.amount = "EUR:1.01", .details.check_bank_transfer.amount = "EUR:1.01",
.details.check_bank_transfer.account_debit = 42, .details.check_bank_transfer.account_debit = 42,
.details.check_bank_transfer.account_credit = 2 .details.check_bank_transfer.account_credit = 2

View File

@ -19,9 +19,9 @@ MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
# How to access our database # How to access our database
DB = postgres DB = postgres
# Base URL of the exchange. Note that the test expects exactly this # Base URL of the exchange. Must be set to a URL where the
# value in the wire transfers. # exchange (or the twister) is actually listening.
BASE_URL = "https://exchange.com/" BASE_URL = "http://localhost:8081/"
[exchangedb-postgres] [exchangedb-postgres]
DB_CONN_STR = "postgres:///talercheck" DB_CONN_STR = "postgres:///talercheck"

View File

@ -19,9 +19,9 @@ MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
# How to access our database # How to access our database
DB = postgres DB = postgres
# Base URL of the exchange. Note that the test expects exactly this # Base URL of the exchange. Must be set to a URL where the
# value in the wire transfers. # exchange (or the twister) is actually listening.
BASE_URL = "https://exchange.com/" BASE_URL = "http://localhost:8081/"
[exchangedb-postgres] [exchangedb-postgres]
DB_CONN_STR = "postgres:///talercheck" DB_CONN_STR = "postgres:///talercheck"

View File

@ -535,7 +535,6 @@ main_wrapper_exchange_connect (void *cls)
struct TALER_TESTING_Interpreter *is = main_ctx->is; struct TALER_TESTING_Interpreter *is = main_ctx->is;
struct GNUNET_CONFIGURATION_Handle *cfg; struct GNUNET_CONFIGURATION_Handle *cfg;
char *exchange_url; char *exchange_url;
long long unsigned int exchange_port;
cfg = GNUNET_CONFIGURATION_create (); cfg = GNUNET_CONFIGURATION_create ();
if (GNUNET_OK != GNUNET_CONFIGURATION_load if (GNUNET_OK != GNUNET_CONFIGURATION_load
@ -543,21 +542,17 @@ main_wrapper_exchange_connect (void *cls)
return; return;
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (cfg, GNUNET_CONFIGURATION_get_value_string (cfg,
"exchange", "exchange",
"PORT", "BASE_URL",
&exchange_port)) &exchange_url))
{ {
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"exchange", "exchange",
"PORT"); "BASE_URL");
GNUNET_CONFIGURATION_destroy (cfg); GNUNET_CONFIGURATION_destroy (cfg);
return; return;
} }
GNUNET_asprintf (&exchange_url,
"http://localhost:%llu/",
exchange_port);
GNUNET_assert ( NULL != GNUNET_assert ( NULL !=
(is->exchange = TALER_EXCHANGE_connect (is->ctx, (is->exchange = TALER_EXCHANGE_connect (is->ctx,
exchange_url, exchange_url,