summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-06-25 19:10:26 +0200
committerChristian Grothoff <christian@grothoff.org>2023-06-25 19:10:26 +0200
commit421129a32ed88fee49108c76e67c16b60f95116b (patch)
tree48238febcdf91df64e1fe35ddaa5958c373ce372 /src/testing
parent75733ee00efc6d5342ed8b4fccd637efaebdce06 (diff)
downloadexchange-421129a32ed88fee49108c76e67c16b60f95116b.tar.gz
exchange-421129a32ed88fee49108c76e67c16b60f95116b.tar.bz2
exchange-421129a32ed88fee49108c76e67c16b60f95116b.zip
next round of exchange API atomization
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing_api_cmd_deposits_get.c23
-rw-r--r--src/testing/testing_api_cmd_purse_create_deposit.c8
-rw-r--r--src/testing/testing_api_cmd_purse_deposit.c8
-rw-r--r--src/testing/testing_api_cmd_purse_get.c19
-rw-r--r--src/testing/testing_api_cmd_purse_merge.c8
-rw-r--r--src/testing/testing_api_cmd_recoup.c21
-rw-r--r--src/testing/testing_api_cmd_recoup_refresh.c25
-rw-r--r--src/testing/testing_api_cmd_refresh.c52
-rw-r--r--src/testing/testing_api_cmd_refund.c27
-rw-r--r--src/testing/testing_api_cmd_reserve_close.c16
-rw-r--r--src/testing/testing_api_cmd_reserve_history.c11
-rw-r--r--src/testing/testing_api_cmd_reserve_open.c4
-rw-r--r--src/testing/testing_api_cmd_reserve_purse.c4
-rw-r--r--src/testing/testing_api_cmd_reserve_status.c11
-rw-r--r--src/testing/testing_api_cmd_transfer_get.c11
15 files changed, 122 insertions, 126 deletions
diff --git a/src/testing/testing_api_cmd_deposits_get.c b/src/testing/testing_api_cmd_deposits_get.c
index 972a85b7c..165af9b18 100644
--- a/src/testing/testing_api_cmd_deposits_get.c
+++ b/src/testing/testing_api_cmd_deposits_get.c
@@ -198,12 +198,8 @@ track_transaction_run (void *cls,
struct TALER_MerchantWireHashP h_wire_details;
struct TALER_PrivateContractHashP h_contract_terms;
const struct TALER_MerchantPrivateKeyP *merchant_priv;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
tts->cmd = cmd;
- if (NULL == exchange)
- return;
tts->is = is;
transaction_cmd
= TALER_TESTING_interpreter_lookup_command (tts->is,
@@ -275,14 +271,17 @@ track_transaction_run (void *cls,
return;
}
- tts->tth = TALER_EXCHANGE_deposits_get (exchange,
- merchant_priv,
- &h_wire_details,
- &h_contract_terms,
- &coin_pub,
- GNUNET_TIME_UNIT_ZERO,
- &deposit_wtid_cb,
- tts);
+ tts->tth = TALER_EXCHANGE_deposits_get (
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
+ merchant_priv,
+ &h_wire_details,
+ &h_contract_terms,
+ &coin_pub,
+ GNUNET_TIME_UNIT_ZERO,
+ &deposit_wtid_cb,
+ tts);
GNUNET_assert (NULL != tts->tth);
}
diff --git a/src/testing/testing_api_cmd_purse_create_deposit.c b/src/testing/testing_api_cmd_purse_create_deposit.c
index 2f13849d2..36dbfbff1 100644
--- a/src/testing/testing_api_cmd_purse_create_deposit.c
+++ b/src/testing/testing_api_cmd_purse_create_deposit.c
@@ -189,12 +189,8 @@ deposit_run (void *cls,
{
struct PurseCreateDepositState *ds = cls;
struct TALER_EXCHANGE_PurseDeposit deposits[ds->num_coin_references];
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
(void) cmd;
- if (NULL == exchange)
- return;
ds->is = is;
for (unsigned int i = 0; i<ds->num_coin_references; i++)
{
@@ -259,7 +255,9 @@ deposit_run (void *cls,
"pay_deadline",
GNUNET_JSON_from_timestamp (ds->purse_expiration)));
ds->dh = TALER_EXCHANGE_purse_create_with_deposit (
- exchange,
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
&ds->purse_priv,
&ds->merge_priv,
&ds->contract_priv,
diff --git a/src/testing/testing_api_cmd_purse_deposit.c b/src/testing/testing_api_cmd_purse_deposit.c
index fb1d51551..8bddc53a6 100644
--- a/src/testing/testing_api_cmd_purse_deposit.c
+++ b/src/testing/testing_api_cmd_purse_deposit.c
@@ -259,11 +259,7 @@ deposit_run (void *cls,
struct TALER_EXCHANGE_PurseDeposit deposits[ds->num_coin_references];
const struct TALER_PurseContractPublicKeyP *purse_pub;
const struct TALER_TESTING_Command *purse_cmd;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
- if (NULL == exchange)
- return;
(void) cmd;
ds->is = is;
purse_cmd = TALER_TESTING_interpreter_lookup_command (is,
@@ -321,7 +317,9 @@ deposit_run (void *cls,
}
ds->dh = TALER_EXCHANGE_purse_deposit (
- exchange,
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
NULL, /* FIXME #7271: WADs support: purse exchange URL */
&ds->purse_pub,
ds->min_age,
diff --git a/src/testing/testing_api_cmd_purse_get.c b/src/testing/testing_api_cmd_purse_get.c
index 235ae63cd..d5246660b 100644
--- a/src/testing/testing_api_cmd_purse_get.c
+++ b/src/testing/testing_api_cmd_purse_get.c
@@ -183,11 +183,7 @@ status_run (void *cls,
{
struct StatusState *ss = cls;
const struct TALER_TESTING_Command *create_purse;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
- if (NULL == exchange)
- return;
ss->is = is;
create_purse
= TALER_TESTING_interpreter_lookup_command (is,
@@ -202,12 +198,15 @@ status_run (void *cls,
TALER_TESTING_interpreter_fail (is);
return;
}
- ss->pgh = TALER_EXCHANGE_purse_get (exchange,
- ss->purse_pub,
- ss->timeout,
- ss->wait_for_merge,
- &purse_status_cb,
- ss);
+ ss->pgh = TALER_EXCHANGE_purse_get (
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
+ ss->purse_pub,
+ ss->timeout,
+ ss->wait_for_merge,
+ &purse_status_cb,
+ ss);
if (! GNUNET_TIME_relative_is_zero (ss->timeout))
{
TALER_TESTING_interpreter_next (is);
diff --git a/src/testing/testing_api_cmd_purse_merge.c b/src/testing/testing_api_cmd_purse_merge.c
index 8f4f6b3c7..503ef162d 100644
--- a/src/testing/testing_api_cmd_purse_merge.c
+++ b/src/testing/testing_api_cmd_purse_merge.c
@@ -201,12 +201,8 @@ merge_run (void *cls,
const struct TALER_PurseMergePrivateKeyP *merge_priv;
const json_t *ct;
const struct TALER_TESTING_Command *ref;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
(void) cmd;
- if (NULL == exchange)
- return;
ds->is = is;
ref = TALER_TESTING_interpreter_lookup_command (ds->is,
ds->merge_ref);
@@ -322,7 +318,9 @@ merge_run (void *cls,
&ds->merge_pub.eddsa_pub);
ds->merge_timestamp = GNUNET_TIME_timestamp_get ();
ds->dh = TALER_EXCHANGE_account_merge (
- exchange,
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
NULL, /* no wad */
&ds->reserve_priv,
&ds->purse_pub,
diff --git a/src/testing/testing_api_cmd_recoup.c b/src/testing/testing_api_cmd_recoup.c
index 9483b1582..263a33034 100644
--- a/src/testing/testing_api_cmd_recoup.c
+++ b/src/testing/testing_api_cmd_recoup.c
@@ -182,11 +182,7 @@ recoup_run (void *cls,
char *cref;
unsigned int idx;
const struct TALER_ExchangeWithdrawValues *ewv;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
- if (NULL == exchange)
- return;
ps->is = is;
if (GNUNET_OK !=
TALER_TESTING_parse_coin_reference (
@@ -259,13 +255,16 @@ recoup_run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Trying to recoup denomination '%s'\n",
TALER_B2S (&denom_pub->h_key));
- ps->ph = TALER_EXCHANGE_recoup (exchange,
- denom_pub,
- coin_sig,
- ewv,
- planchet,
- &recoup_cb,
- ps);
+ ps->ph = TALER_EXCHANGE_recoup (
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
+ denom_pub,
+ coin_sig,
+ ewv,
+ planchet,
+ &recoup_cb,
+ ps);
GNUNET_assert (NULL != ps->ph);
}
diff --git a/src/testing/testing_api_cmd_recoup_refresh.c b/src/testing/testing_api_cmd_recoup_refresh.c
index 1c7456c73..7de5b96df 100644
--- a/src/testing/testing_api_cmd_recoup_refresh.c
+++ b/src/testing/testing_api_cmd_recoup_refresh.c
@@ -184,11 +184,7 @@ recoup_refresh_run (void *cls,
const struct TALER_ExchangeWithdrawValues *ewv;
char *cref;
unsigned int idx;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
- if (NULL == exchange)
- return;
rrs->is = is;
if (GNUNET_OK !=
TALER_TESTING_parse_coin_reference (
@@ -273,15 +269,18 @@ recoup_refresh_run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Trying to recoup_refresh denomination '%s'\n",
TALER_B2S (&denom_pub->h_key));
- rrs->ph = TALER_EXCHANGE_recoup_refresh (exchange,
- denom_pub,
- coin_sig,
- ewv,
- rplanchet,
- planchet,
- idx,
- &recoup_refresh_cb,
- rrs);
+ rrs->ph = TALER_EXCHANGE_recoup_refresh (
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
+ denom_pub,
+ coin_sig,
+ ewv,
+ rplanchet,
+ planchet,
+ idx,
+ &recoup_refresh_cb,
+ rrs);
GNUNET_assert (NULL != rrs->ph);
}
diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c
index 3b420ac66..dfaf31fd4 100644
--- a/src/testing/testing_api_cmd_refresh.c
+++ b/src/testing/testing_api_cmd_refresh.c
@@ -496,12 +496,8 @@ refresh_reveal_run (void *cls,
struct RefreshRevealState *rrs = cls;
struct RefreshMeltState *rms;
const struct TALER_TESTING_Command *melt_cmd;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
rrs->cmd = cmd;
- if (NULL == exchange)
- return;
rrs->is = is;
melt_cmd = TALER_TESTING_interpreter_lookup_command (is,
rrs->melt_reference);
@@ -518,14 +514,16 @@ refresh_reveal_run (void *cls,
for (unsigned int i = 0; i<rms->num_fresh_coins; i++)
alg_values[i] = rms->mbds[i].alg_value;
- rrs->rrh = TALER_EXCHANGE_refreshes_reveal (exchange,
- &rms->rms,
- &rms->refresh_data,
- rms->num_fresh_coins,
- alg_values,
- rms->noreveal_index,
- &reveal_cb,
- rrs);
+ rrs->rrh = TALER_EXCHANGE_refreshes_reveal (
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ &rms->rms,
+ &rms->refresh_data,
+ rms->num_fresh_coins,
+ alg_values,
+ rms->noreveal_index,
+ &reveal_cb,
+ rrs);
}
if (NULL == rrs->rrh)
{
@@ -913,12 +911,8 @@ melt_cb (void *cls,
{
struct RefreshMeltState *rms = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &mr->hr;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (rms->is);
rms->rmh = NULL;
- if (NULL == exchange)
- return;
if (rms->expected_response_code != hr->http_status)
{
if (0 != rms->do_retry)
@@ -978,11 +972,14 @@ melt_cb (void *cls,
{
TALER_LOG_DEBUG ("Doubling the melt (%s)\n",
rms->cmd->label);
- rms->rmh = TALER_EXCHANGE_melt (exchange,
- &rms->rms,
- &rms->refresh_data,
- &melt_cb,
- rms);
+ rms->rmh = TALER_EXCHANGE_melt (
+ TALER_TESTING_interpreter_get_context (rms->is),
+ TALER_TESTING_get_exchange_url (rms->is),
+ TALER_TESTING_get_keys (rms->is),
+ &rms->rms,
+ &rms->refresh_data,
+ &melt_cb,
+ rms);
rms->double_melt = false;
return;
}
@@ -1154,11 +1151,14 @@ melt_run (void *cls,
GNUNET_assert (age_restricted ==
(NULL != age_commitment_proof));
- rms->rmh = TALER_EXCHANGE_melt (exchange,
- &rms->rms,
- &rms->refresh_data,
- &melt_cb,
- rms);
+ rms->rmh = TALER_EXCHANGE_melt (
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
+ &rms->rms,
+ &rms->refresh_data,
+ &melt_cb,
+ rms);
if (NULL == rms->rmh)
{
diff --git a/src/testing/testing_api_cmd_refund.c b/src/testing/testing_api_cmd_refund.c
index a3ebd2e85..b8ce85f96 100644
--- a/src/testing/testing_api_cmd_refund.c
+++ b/src/testing/testing_api_cmd_refund.c
@@ -54,11 +54,6 @@ struct RefundState
uint64_t refund_transaction_id;
/**
- * Connection to the exchange.
- */
- struct TALER_EXCHANGE_Handle *exchange;
-
- /**
* Handle to the refund operation.
*/
struct TALER_EXCHANGE_RefundHandle *rh;
@@ -116,9 +111,6 @@ refund_run (void *cls,
const struct TALER_MerchantPrivateKeyP *merchant_priv;
const struct TALER_TESTING_Command *coin_cmd;
- rs->exchange = TALER_TESTING_get_exchange (is);
- if (NULL == rs->exchange)
- return;
rs->is = is;
if (GNUNET_OK !=
TALER_string_to_amount (rs->refund_amount,
@@ -172,14 +164,17 @@ refund_run (void *cls,
TALER_TESTING_interpreter_fail (is);
return;
}
- rs->rh = TALER_EXCHANGE_refund (rs->exchange,
- &refund_amount,
- &h_contract_terms,
- &coin,
- rs->refund_transaction_id,
- merchant_priv,
- &refund_cb,
- rs);
+ rs->rh = TALER_EXCHANGE_refund (
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
+ &refund_amount,
+ &h_contract_terms,
+ &coin,
+ rs->refund_transaction_id,
+ merchant_priv,
+ &refund_cb,
+ rs);
GNUNET_assert (NULL != rs->rh);
}
diff --git a/src/testing/testing_api_cmd_reserve_close.c b/src/testing/testing_api_cmd_reserve_close.c
index b2929f164..8e272f547 100644
--- a/src/testing/testing_api_cmd_reserve_close.c
+++ b/src/testing/testing_api_cmd_reserve_close.c
@@ -142,11 +142,7 @@ close_run (void *cls,
{
struct CloseState *ss = cls;
const struct TALER_TESTING_Command *create_reserve;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
- if (NULL == exchange)
- return;
ss->is = is;
create_reserve
= TALER_TESTING_interpreter_lookup_command (is,
@@ -169,11 +165,13 @@ close_run (void *cls,
}
GNUNET_CRYPTO_eddsa_key_get_public (&ss->reserve_priv->eddsa_priv,
&ss->reserve_pub.eddsa_pub);
- ss->rsh = TALER_EXCHANGE_reserves_close (exchange,
- ss->reserve_priv,
- ss->target_account,
- &reserve_close_cb,
- ss);
+ ss->rsh = TALER_EXCHANGE_reserves_close (
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ ss->reserve_priv,
+ ss->target_account,
+ &reserve_close_cb,
+ ss);
}
diff --git a/src/testing/testing_api_cmd_reserve_history.c b/src/testing/testing_api_cmd_reserve_history.c
index e9cc11a6d..6e68bbe26 100644
--- a/src/testing/testing_api_cmd_reserve_history.c
+++ b/src/testing/testing_api_cmd_reserve_history.c
@@ -369,10 +369,13 @@ history_run (void *cls,
}
GNUNET_CRYPTO_eddsa_key_get_public (&ss->reserve_priv->eddsa_priv,
&ss->reserve_pub.eddsa_pub);
- ss->rsh = TALER_EXCHANGE_reserves_history (exchange,
- ss->reserve_priv,
- &reserve_history_cb,
- ss);
+ ss->rsh = TALER_EXCHANGE_reserves_history (
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
+ ss->reserve_priv,
+ &reserve_history_cb,
+ ss);
}
diff --git a/src/testing/testing_api_cmd_reserve_open.c b/src/testing/testing_api_cmd_reserve_open.c
index 6a6247b8d..a78662c33 100644
--- a/src/testing/testing_api_cmd_reserve_open.c
+++ b/src/testing/testing_api_cmd_reserve_open.c
@@ -256,7 +256,9 @@ open_run (void *cls,
cpi->h_denom_pub = denom_pub->h_key;
}
ss->rsh = TALER_EXCHANGE_reserves_open (
- exchange,
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
ss->reserve_priv,
&ss->reserve_pay,
ss->cpl,
diff --git a/src/testing/testing_api_cmd_reserve_purse.c b/src/testing/testing_api_cmd_reserve_purse.c
index 79530803a..7a356c231 100644
--- a/src/testing/testing_api_cmd_reserve_purse.c
+++ b/src/testing/testing_api_cmd_reserve_purse.c
@@ -245,7 +245,9 @@ purse_run (void *cls,
GNUNET_JSON_from_timestamp (ds->purse_expiration)));
ds->merge_timestamp = GNUNET_TIME_timestamp_get ();
ds->dh = TALER_EXCHANGE_purse_create_with_merge (
- exchange,
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
&ds->reserve_priv,
&ds->purse_priv,
&ds->merge_priv,
diff --git a/src/testing/testing_api_cmd_reserve_status.c b/src/testing/testing_api_cmd_reserve_status.c
index 7e7b45cd7..2da1bf740 100644
--- a/src/testing/testing_api_cmd_reserve_status.c
+++ b/src/testing/testing_api_cmd_reserve_status.c
@@ -341,10 +341,13 @@ status_run (void *cls,
}
GNUNET_CRYPTO_eddsa_key_get_public (&ss->reserve_priv->eddsa_priv,
&ss->reserve_pub.eddsa_pub);
- ss->rsh = TALER_EXCHANGE_reserves_status (exchange,
- ss->reserve_priv,
- &reserve_status_cb,
- ss);
+ ss->rsh = TALER_EXCHANGE_reserves_status (
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
+ ss->reserve_priv,
+ &reserve_status_cb,
+ ss);
}
diff --git a/src/testing/testing_api_cmd_transfer_get.c b/src/testing/testing_api_cmd_transfer_get.c
index 10fe48c2c..37fe736ba 100644
--- a/src/testing/testing_api_cmd_transfer_get.c
+++ b/src/testing/testing_api_cmd_transfer_get.c
@@ -345,10 +345,13 @@ track_transfer_run (void *cls,
}
GNUNET_assert (NULL != wtid_ptr);
}
- tts->tth = TALER_EXCHANGE_transfers_get (exchange,
- wtid_ptr,
- &track_transfer_cb,
- tts);
+ tts->tth = TALER_EXCHANGE_transfers_get (
+ TALER_TESTING_interpreter_get_context (is),
+ TALER_TESTING_get_exchange_url (is),
+ TALER_TESTING_get_keys (is),
+ wtid_ptr,
+ &track_transfer_cb,
+ tts);
GNUNET_assert (NULL != tts->tth);
}