summaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-06-22 22:05:34 +0200
committerChristian Grothoff <christian@grothoff.org>2023-06-22 22:05:34 +0200
commit720783b66a08a14624f30e8063daf64d25ce3e4c (patch)
tree24ae1feb57b363e18f279f9907e2b8cd37f87a62 /src/testing
parent999dae7c5d0c37473e486fa38816a3f35c42dba9 (diff)
downloadexchange-720783b66a08a14624f30e8063daf64d25ce3e4c.tar.gz
exchange-720783b66a08a14624f30e8063daf64d25ce3e4c.tar.bz2
exchange-720783b66a08a14624f30e8063daf64d25ce3e4c.zip
-more exchange API atomization
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing_api_cmd_kyc_proof.c25
-rw-r--r--src/testing/testing_api_cmd_kyc_wallet_get.c25
-rw-r--r--src/testing/testing_api_cmd_refresh.c23
-rw-r--r--src/testing/testing_api_cmd_reserve_attest.c25
4 files changed, 59 insertions, 39 deletions
diff --git a/src/testing/testing_api_cmd_kyc_proof.c b/src/testing/testing_api_cmd_kyc_proof.c
index 291378d97..c0fe7495a 100644
--- a/src/testing/testing_api_cmd_kyc_proof.c
+++ b/src/testing/testing_api_cmd_kyc_proof.c
@@ -127,13 +127,16 @@ proof_kyc_run (void *cls,
const struct TALER_TESTING_Command *res_cmd;
const struct TALER_PaytoHashP *h_payto;
char *uargs;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
+ const char *exchange_url;
(void) cmd;
- if (NULL == exchange)
- return;
kps->is = is;
+ exchange_url = TALER_TESTING_get_exchange_url (is);
+ if (NULL == exchange_url)
+ {
+ GNUNET_break (0);
+ return;
+ }
res_cmd = TALER_TESTING_interpreter_lookup_command (
kps->is,
kps->payment_target_reference);
@@ -157,12 +160,14 @@ proof_kyc_run (void *cls,
GNUNET_asprintf (&uargs,
"&code=%s",
kps->code);
- kps->kph = TALER_EXCHANGE_kyc_proof (exchange,
- h_payto,
- kps->logic,
- uargs,
- &proof_kyc_cb,
- kps);
+ kps->kph = TALER_EXCHANGE_kyc_proof (
+ TALER_TESTING_interpreter_get_context (is),
+ exchange_url,
+ h_payto,
+ kps->logic,
+ uargs,
+ &proof_kyc_cb,
+ kps);
GNUNET_free (uargs);
GNUNET_assert (NULL != kps->kph);
}
diff --git a/src/testing/testing_api_cmd_kyc_wallet_get.c b/src/testing/testing_api_cmd_kyc_wallet_get.c
index 5f6eaeb4c..fa6edab20 100644
--- a/src/testing/testing_api_cmd_kyc_wallet_get.c
+++ b/src/testing/testing_api_cmd_kyc_wallet_get.c
@@ -147,13 +147,16 @@ wallet_kyc_run (void *cls,
struct TALER_TESTING_Interpreter *is)
{
struct KycWalletGetState *kwg = cls;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
+ const char *exchange_url;
kwg->cmd = cmd;
- if (NULL == exchange)
- return;
kwg->is = is;
+ exchange_url = TALER_TESTING_get_exchange_url (is);
+ if (NULL == exchange_url)
+ {
+ GNUNET_break (0);
+ return;
+ }
if (NULL != kwg->reserve_reference)
{
const struct TALER_TESTING_Command *res_cmd;
@@ -185,13 +188,15 @@ wallet_kyc_run (void *cls,
GNUNET_CRYPTO_eddsa_key_get_public (&kwg->reserve_priv.eddsa_priv,
&kwg->reserve_pub.eddsa_pub);
kwg->reserve_payto_uri
- = TALER_reserve_make_payto (TALER_EXCHANGE_get_base_url (exchange),
+ = TALER_reserve_make_payto (exchange_url,
&kwg->reserve_pub);
- kwg->kwh = TALER_EXCHANGE_kyc_wallet (exchange,
- &kwg->reserve_priv,
- &kwg->balance,
- &wallet_kyc_cb,
- kwg);
+ kwg->kwh = TALER_EXCHANGE_kyc_wallet (
+ TALER_TESTING_interpreter_get_context (is),
+ exchange_url,
+ &kwg->reserve_priv,
+ &kwg->balance,
+ &wallet_kyc_cb,
+ kwg);
GNUNET_assert (NULL != kwg->kwh);
}
diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c
index a15e8dbc6..3b420ac66 100644
--- a/src/testing/testing_api_cmd_refresh.c
+++ b/src/testing/testing_api_cmd_refresh.c
@@ -783,13 +783,16 @@ refresh_link_run (void *cls,
const struct TALER_TESTING_Command *reveal_cmd;
const struct TALER_TESTING_Command *melt_cmd;
const struct TALER_TESTING_Command *coin_cmd;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
+ const char *exchange_url;
rls->cmd = cmd;
- if (NULL == exchange)
- return;
rls->is = is;
+ exchange_url = TALER_TESTING_get_exchange_url (is);
+ if (NULL == exchange_url)
+ {
+ GNUNET_break (0);
+ return;
+ }
reveal_cmd = TALER_TESTING_interpreter_lookup_command (rls->is,
rls->reveal_reference);
if (NULL == reveal_cmd)
@@ -832,11 +835,13 @@ refresh_link_run (void *cls,
}
/* finally, use private key from withdraw sign command */
- rls->rlh = TALER_EXCHANGE_link (exchange,
- coin_priv,
- rms->refresh_data.melt_age_commitment_proof,
- &link_cb,
- rls);
+ rls->rlh = TALER_EXCHANGE_link (
+ TALER_TESTING_interpreter_get_context (is),
+ exchange_url,
+ coin_priv,
+ rms->refresh_data.melt_age_commitment_proof,
+ &link_cb,
+ rls);
if (NULL == rls->rlh)
{
diff --git a/src/testing/testing_api_cmd_reserve_attest.c b/src/testing/testing_api_cmd_reserve_attest.c
index 77166d2b5..64b15a10d 100644
--- a/src/testing/testing_api_cmd_reserve_attest.c
+++ b/src/testing/testing_api_cmd_reserve_attest.c
@@ -152,12 +152,15 @@ attest_run (void *cls,
{
struct AttestState *ss = cls;
const struct TALER_TESTING_Command *create_reserve;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
+ const char *exchange_url;
- if (NULL == exchange)
- return;
ss->is = is;
+ exchange_url = TALER_TESTING_get_exchange_url (is);
+ if (NULL == exchange_url)
+ {
+ GNUNET_break (0);
+ return;
+ }
create_reserve
= TALER_TESTING_interpreter_lookup_command (is,
ss->reserve_reference);
@@ -179,12 +182,14 @@ attest_run (void *cls,
}
GNUNET_CRYPTO_eddsa_key_get_public (&ss->reserve_priv->eddsa_priv,
&ss->reserve_pub.eddsa_pub);
- ss->rsh = TALER_EXCHANGE_reserves_attest (exchange,
- ss->reserve_priv,
- ss->attrs_len,
- ss->attrs,
- &reserve_attest_cb,
- ss);
+ ss->rsh = TALER_EXCHANGE_reserves_attest (
+ TALER_TESTING_interpreter_get_context (is),
+ exchange_url,
+ ss->reserve_priv,
+ ss->attrs_len,
+ ss->attrs,
+ &reserve_attest_cb,
+ ss);
}