aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/test_auditor_api.c2
-rw-r--r--src/testing/test_exchange_api.c2
-rw-r--r--src/testing/test_exchange_api_keys_cherry_picking.c2
-rw-r--r--src/testing/test_exchange_api_overlapping_keys_bug.c2
-rw-r--r--src/testing/test_exchange_api_revocation.c2
-rw-r--r--src/testing/test_exchange_management_api.c2
-rw-r--r--src/testing/test_exchange_p2p.c2
-rw-r--r--src/testing/test_kyc_api.c2
-rw-r--r--src/testing/test_taler_exchange_wirewatch.c2
-rw-r--r--src/testing/testing_api_cmd_auditor_deposit_confirmation.c6
-rw-r--r--src/testing/testing_api_cmd_batch_withdraw.c8
-rw-r--r--src/testing/testing_api_cmd_check_keys.c118
-rw-r--r--src/testing/testing_api_cmd_connect_with_state.c32
-rw-r--r--src/testing/testing_api_cmd_get_exchange.c41
-rw-r--r--src/testing/testing_api_cmd_purse_deposit.c7
-rw-r--r--src/testing/testing_api_cmd_refresh.c10
-rw-r--r--src/testing/testing_api_cmd_reserve_history.c12
-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.c4
-rw-r--r--src/testing/testing_api_cmd_serialize_keys.c10
-rw-r--r--src/testing/testing_api_cmd_transfer_get.c4
-rw-r--r--src/testing/testing_api_cmd_withdraw.c6
-rw-r--r--src/testing/testing_api_traits.c27
24 files changed, 105 insertions, 206 deletions
diff --git a/src/testing/test_auditor_api.c b/src/testing/test_auditor_api.c
index 4e643f176..b5d6df0c4 100644
--- a/src/testing/test_auditor_api.c
+++ b/src/testing/test_auditor_api.c
@@ -658,7 +658,7 @@ run (void *cls,
TALER_TESTING_cmd_get_auditor ("get-auditor",
cred.cfg,
true),
- TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
+ // FIXME: TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
TALER_TESTING_cmd_exec_auditor_offline ("auditor-offline",
config_file),
CMD_RUN_AUDITOR ("virgin-auditor"),
diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c
index eb131d65e..e8cc6659f 100644
--- a/src/testing/test_exchange_api.c
+++ b/src/testing/test_exchange_api.c
@@ -1238,7 +1238,7 @@ run (void *cls,
cred.cfg,
true,
true),
- TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
+ // FIXME: TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
TALER_TESTING_cmd_batch ("wire",
wire),
TALER_TESTING_cmd_batch ("withdraw",
diff --git a/src/testing/test_exchange_api_keys_cherry_picking.c b/src/testing/test_exchange_api_keys_cherry_picking.c
index b463eea8f..11e18e5cb 100644
--- a/src/testing/test_exchange_api_keys_cherry_picking.c
+++ b/src/testing/test_exchange_api_keys_cherry_picking.c
@@ -67,7 +67,7 @@ run (void *cls,
cred.cfg,
true,
true),
- TALER_TESTING_cmd_check_keys_pull_all_keys ("initial-/keys"),
+ // FIXME: TALER_TESTING_cmd_check_keys_pull_all_keys ("initial-/keys"),
TALER_TESTING_cmd_sleep ("sleep",
6 /* seconds */),
TALER_TESTING_cmd_check_keys ("check-keys-1"),
diff --git a/src/testing/test_exchange_api_overlapping_keys_bug.c b/src/testing/test_exchange_api_overlapping_keys_bug.c
index 7cbdd9b80..3f7353b91 100644
--- a/src/testing/test_exchange_api_overlapping_keys_bug.c
+++ b/src/testing/test_exchange_api_overlapping_keys_bug.c
@@ -71,7 +71,7 @@ run (void *cls,
cred.cfg,
true,
true),
- TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
+ // FIXME: TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
TALER_TESTING_cmd_check_keys ("first-download"),
/* Causes GET /keys?last_denom_issue=0 */
TALER_TESTING_cmd_check_keys_with_last_denom ("second-download",
diff --git a/src/testing/test_exchange_api_revocation.c b/src/testing/test_exchange_api_revocation.c
index c1c1b3190..1cb544dad 100644
--- a/src/testing/test_exchange_api_revocation.c
+++ b/src/testing/test_exchange_api_revocation.c
@@ -80,7 +80,7 @@ run (void *cls,
TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys",
config_file),
#endif
- TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
+ // FIXME: TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
/**
* Fill reserve with EUR:10.02, as withdraw fee is 1 ct per
* config.
diff --git a/src/testing/test_exchange_management_api.c b/src/testing/test_exchange_management_api.c
index cabddcdef..fded3f037 100644
--- a/src/testing/test_exchange_management_api.c
+++ b/src/testing/test_exchange_management_api.c
@@ -145,7 +145,7 @@ run (void *cls,
false),
TALER_TESTING_cmd_exec_offline_sign_keys ("download-future-keys",
config_file),
- TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
+ // FIXME: TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
TALER_TESTING_cmd_end ()
};
diff --git a/src/testing/test_exchange_p2p.c b/src/testing/test_exchange_p2p.c
index f5b11f608..689d2460e 100644
--- a/src/testing/test_exchange_p2p.c
+++ b/src/testing/test_exchange_p2p.c
@@ -506,7 +506,7 @@ run (void *cls,
cred.cfg,
true,
true),
- TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
+ // FIXME: TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
TALER_TESTING_cmd_batch ("withdraw",
withdraw),
TALER_TESTING_cmd_batch ("push",
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c
index eb66d9c85..733a5e2f7 100644
--- a/src/testing/test_kyc_api.c
+++ b/src/testing/test_kyc_api.c
@@ -525,7 +525,7 @@ run (void *cls,
cred.cfg,
true,
true),
- TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
+ // FIXME: TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
TALER_TESTING_cmd_batch ("withdraw",
withdraw),
TALER_TESTING_cmd_batch ("spend",
diff --git a/src/testing/test_taler_exchange_wirewatch.c b/src/testing/test_taler_exchange_wirewatch.c
index 86e104f4a..54d258879 100644
--- a/src/testing/test_taler_exchange_wirewatch.c
+++ b/src/testing/test_taler_exchange_wirewatch.c
@@ -89,7 +89,7 @@ run (void *cls,
cred.cfg,
true,
true),
- TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
+ // FIXME: TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys"),
TALER_TESTING_cmd_check_bank_empty ("expect-empty-transactions-on-start"),
CMD_EXEC_AGGREGATOR ("run-aggregator-on-empty"),
TALER_TESTING_cmd_exec_wirewatch ("run-wirewatch-on-empty",
diff --git a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
index 5c7b76a31..252e8f522 100644
--- a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
+++ b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
@@ -211,12 +211,8 @@ deposit_confirmation_run (void *cls,
const struct TALER_EXCHANGE_Keys *keys;
const struct TALER_EXCHANGE_SigningPublicKey *spk;
const char *auditor_url;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
(void) cmd;
- if (NULL == exchange)
- return;
dcs->is = is;
GNUNET_assert (NULL != dcs->deposit_reference);
{
@@ -267,7 +263,7 @@ deposit_confirmation_run (void *cls,
dcs->coin_index,
&wire_deadline));
GNUNET_assert (NULL != exchange_timestamp);
- keys = TALER_EXCHANGE_get_keys (exchange);
+ keys = TALER_TESTING_get_keys (is);
GNUNET_assert (NULL != keys);
spk = TALER_EXCHANGE_get_signing_key_info (keys,
exchange_pub);
diff --git a/src/testing/testing_api_cmd_batch_withdraw.c b/src/testing/testing_api_cmd_batch_withdraw.c
index 56af70b14..7f6809492 100644
--- a/src/testing/testing_api_cmd_batch_withdraw.c
+++ b/src/testing/testing_api_cmd_batch_withdraw.c
@@ -253,12 +253,8 @@ batch_withdraw_run (void *cls,
const struct TALER_TESTING_Command *create_reserve;
const struct TALER_EXCHANGE_DenomPublicKey *dpk;
struct TALER_EXCHANGE_WithdrawCoinInput wcis[ws->num_coins];
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
(void) cmd;
- if (NULL == exchange)
- return;
ws->is = is;
create_reserve
= TALER_TESTING_interpreter_lookup_command (
@@ -281,7 +277,7 @@ batch_withdraw_run (void *cls,
}
if (NULL == ws->exchange_url)
ws->exchange_url
- = GNUNET_strdup (TALER_EXCHANGE_get_base_url (exchange));
+ = GNUNET_strdup (TALER_TESTING_get_exchange_url (is));
ws->reserve_priv = *rp;
GNUNET_CRYPTO_eddsa_key_get_public (&ws->reserve_priv.eddsa_priv,
&ws->reserve_pub.eddsa_pub);
@@ -295,7 +291,7 @@ batch_withdraw_run (void *cls,
struct TALER_EXCHANGE_WithdrawCoinInput *wci = &wcis[i];
TALER_planchet_master_setup_random (&cs->ps);
- dpk = TALER_TESTING_find_pk (TALER_EXCHANGE_get_keys (exchange),
+ dpk = TALER_TESTING_find_pk (TALER_TESTING_get_keys (is),
&cs->amount,
ws->age > 0);
if (NULL == dpk)
diff --git a/src/testing/testing_api_cmd_check_keys.c b/src/testing/testing_api_cmd_check_keys.c
index f4ea126e6..bb26d10a4 100644
--- a/src/testing/testing_api_cmd_check_keys.c
+++ b/src/testing/testing_api_cmd_check_keys.c
@@ -27,6 +27,8 @@
#include <gnunet/gnunet_curl_lib.h>
#include "taler_testing_lib.h"
+// FIXME: duplicated with testing_api_cmd_connect_with_state
+// FIXME: this is now duplicated with testing_api_cmd_get_exchange!
/**
* State for a "check keys" CMD.
@@ -35,13 +37,8 @@ struct CheckKeysState
{
/**
- * If this value is true, then the "cherry picking" facility is turned off;
- * whole /keys is downloaded.
- */
- bool pull_all_keys;
-
- /**
* Label of a command to use to derive the "last_denom_issue" date to use.
+ * FIXME: actually use this!
*/
const char *last_denom_date_ref;
@@ -51,6 +48,11 @@ struct CheckKeysState
struct TALER_TESTING_Interpreter *is;
/**
+ * Our get keys operation.
+ */
+ struct TALER_EXCHANGE_GetKeysHandle *gkh;
+
+ /**
* Last denomination date we received when doing this request.
*/
struct GNUNET_TIME_Timestamp my_denom_date;
@@ -66,7 +68,8 @@ struct CheckKeysState
*/
static void
keys_cb (void *cls,
- const struct TALER_EXCHANGE_KeysResponse *kr)
+ const struct TALER_EXCHANGE_KeysResponse *kr,
+ struct TALER_EXCHANGE_Keys *keys)
{
struct CheckKeysState *cks = cls;
@@ -77,6 +80,8 @@ keys_cb (void *cls,
return;
}
cks->my_denom_date = kr->details.ok.keys->last_denom_issue_date;
+ /* FIXME: expose keys (and exchange_url) via trait! */
+ TALER_EXCHANGE_keys_decref (keys);
TALER_TESTING_interpreter_next (cks->is);
}
@@ -94,64 +99,19 @@ check_keys_run (void *cls,
struct TALER_TESTING_Interpreter *is)
{
struct CheckKeysState *cks = cls;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
- struct GNUNET_TIME_Timestamp rdate;
+ const char *exchange_url
+ = TALER_TESTING_get_exchange_url (is);
- (void) cmd;
cks->is = is;
- if (NULL == exchange)
- return;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Triggering GET /keys, cmd `%s'\n",
cmd->label);
- if (NULL != cks->last_denom_date_ref)
- {
- if (0 == strcmp ("zero",
- cks->last_denom_date_ref))
- {
- TALER_LOG_DEBUG ("Forcing last_denom_date URL argument set to zero\n");
- TALER_EXCHANGE_set_last_denom (exchange,
- GNUNET_TIME_UNIT_ZERO_TS);
- }
- else
- {
- const struct GNUNET_TIME_Timestamp *last_denom_date;
- const struct TALER_TESTING_Command *ref;
-
- ref = TALER_TESTING_interpreter_lookup_command (is,
- cks->last_denom_date_ref);
- if (NULL == ref)
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (is);
- return;
- }
- if (GNUNET_OK !=
- TALER_TESTING_get_trait_timestamp (ref,
- 0,
- &last_denom_date))
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (is);
- return;
- }
-
- TALER_LOG_DEBUG ("Forcing last_denom_date URL argument\n");
- TALER_EXCHANGE_set_last_denom (exchange,
- *last_denom_date);
- }
- }
-
- rdate = TALER_EXCHANGE_check_keys_current (
- exchange,
- cks->pull_all_keys
- ? TALER_EXCHANGE_CKF_FORCE_ALL_NOW
- : TALER_EXCHANGE_CKF_FORCE_DOWNLOAD,
+ cks->gkh = TALER_EXCHANGE_get_keys (
+ TALER_TESTING_interpreter_get_context (is),
+ exchange_url,
+ NULL, /* FIXME: get form last_denom_date_ref! */
&keys_cb,
cks);
- /* Redownload /keys. */
- GNUNET_break (GNUNET_TIME_absolute_is_zero (rdate.abs_time));
}
@@ -168,6 +128,11 @@ check_keys_cleanup (void *cls,
struct CheckKeysState *cks = cls;
(void) cmd;
+ if (NULL != cks->gkh)
+ {
+ TALER_EXCHANGE_get_keys_cancel (cks->gkh);
+ cks->gkh = NULL;
+ }
GNUNET_free (cks);
}
@@ -205,9 +170,20 @@ check_keys_traits (void *cls,
struct TALER_TESTING_Command
TALER_TESTING_cmd_check_keys (const char *label)
{
+ return TALER_TESTING_cmd_check_keys_with_last_denom (label,
+ NULL);
+}
+
+
+struct TALER_TESTING_Command
+TALER_TESTING_cmd_check_keys_with_last_denom (
+ const char *label,
+ const char *last_denom_date_ref)
+{
struct CheckKeysState *cks;
cks = GNUNET_new (struct CheckKeysState);
+ cks->last_denom_date_ref = last_denom_date_ref;
{
struct TALER_TESTING_Command cmd = {
.cls = cks,
@@ -222,30 +198,4 @@ TALER_TESTING_cmd_check_keys (const char *label)
}
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_check_keys_pull_all_keys (const char *label)
-{
- struct TALER_TESTING_Command cmd
- = TALER_TESTING_cmd_check_keys (label);
- struct CheckKeysState *cks = cmd.cls;
-
- cks->pull_all_keys = true;
- return cmd;
-}
-
-
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_check_keys_with_last_denom (
- const char *label,
- const char *last_denom_date_ref)
-{
- struct TALER_TESTING_Command cmd
- = TALER_TESTING_cmd_check_keys (label);
- struct CheckKeysState *cks = cmd.cls;
-
- cks->last_denom_date_ref = last_denom_date_ref;
- return cmd;
-}
-
-
/* end of testing_api_cmd_check_keys.c */
diff --git a/src/testing/testing_api_cmd_connect_with_state.c b/src/testing/testing_api_cmd_connect_with_state.c
index 95e860f17..81587248d 100644
--- a/src/testing/testing_api_cmd_connect_with_state.c
+++ b/src/testing/testing_api_cmd_connect_with_state.c
@@ -26,6 +26,9 @@
#include "taler_testing_lib.h"
+// FIXME: this is now duplicated with testing_api_cmd_check_keys!
+// FIXME: this is now duplicated with testing_api_cmd_get_exchange!
+
/**
* Internal state for a connect-with-state CMD.
*/
@@ -46,13 +49,19 @@ struct ConnectWithStateState
/**
* New exchange handle.
*/
- struct TALER_EXCHANGE_Handle *exchange;
+ struct TALER_EXCHANGE_GetKeysHandle *exchange;
+
+ /**
+ * Keys handle.
+ */
+ struct TALER_EXCHANGE_Keys *keys;
};
static void
cert_cb (void *cls,
- const struct TALER_EXCHANGE_KeysResponse *kr)
+ const struct TALER_EXCHANGE_KeysResponse *kr,
+ struct TALER_EXCHANGE_Keys *keys)
{
struct ConnectWithStateState *cwss = cls;
struct TALER_TESTING_Interpreter *is = cwss->is;
@@ -72,6 +81,7 @@ cert_cb (void *cls,
TALER_TESTING_interpreter_fail (is);
return;
}
+ cwss->keys = keys;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Got %d DK from /keys\n",
kr->details.ok.keys->num_denom_keys);
@@ -113,14 +123,12 @@ connect_with_state_run (void *cls,
TALER_TESTING_get_trait_exchange_url (state_cmd,
&exchange_url));
cwss->exchange
- = TALER_EXCHANGE_connect (
+ = TALER_EXCHANGE_get_keys (
TALER_TESTING_interpreter_get_context (is),
exchange_url,
+ TALER_EXCHANGE_keys_from_json (serialized_keys),
&cert_cb,
- cwss,
- TALER_EXCHANGE_OPTION_DATA,
- serialized_keys,
- TALER_EXCHANGE_OPTION_END);
+ cwss);
}
@@ -141,7 +149,8 @@ connect_with_state_traits (void *cls,
{
struct ConnectWithStateState *cwss = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_exchange (cwss->exchange),
+ TALER_TESTING_make_trait_keys (cwss->keys),
+ // FIXME: also expose exchange_url as trait
TALER_TESTING_trait_end ()
};
@@ -165,6 +174,13 @@ connect_with_state_cleanup (void *cls,
{
struct ConnectWithStateState *cwss = cls;
+ TALER_EXCHANGE_keys_decref (cwss->keys);
+ cwss->keys = NULL;
+ if (NULL != cwss->exchange)
+ {
+ TALER_EXCHANGE_get_keys_cancel (cwss->exchange);
+ cwss->exchange = NULL;
+ }
GNUNET_free (cwss);
}
diff --git a/src/testing/testing_api_cmd_get_exchange.c b/src/testing/testing_api_cmd_get_exchange.c
index 2822616c0..b6634286a 100644
--- a/src/testing/testing_api_cmd_get_exchange.c
+++ b/src/testing/testing_api_cmd_get_exchange.c
@@ -46,7 +46,12 @@ struct GetExchangeState
/**
* Exchange handle we produced.
*/
- struct TALER_EXCHANGE_Handle *exchange;
+ struct TALER_EXCHANGE_GetKeysHandle *exchange;
+
+ /**
+ * Keys of the exchange.
+ */
+ struct TALER_EXCHANGE_Keys *keys;
/**
* URL of the exchange.
@@ -67,12 +72,15 @@ struct GetExchangeState
static void
cert_cb (void *cls,
- const struct TALER_EXCHANGE_KeysResponse *kr)
+ const struct TALER_EXCHANGE_KeysResponse *kr,
+ struct TALER_EXCHANGE_Keys *keys)
{
struct GetExchangeState *ges = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &kr->hr;
struct TALER_TESTING_Interpreter *is = ges->is;
+ ges->exchange = NULL;
+ ges->keys = keys;
switch (hr->http_status)
{
case MHD_HTTP_OK:
@@ -85,8 +93,9 @@ cert_cb (void *cls,
return;
default:
GNUNET_break (0);
- TALER_EXCHANGE_disconnect (ges->exchange);
- ges->exchange = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "/keys responded with HTTP status %u\n",
+ hr->http_status);
if (ges->wait_for_keys)
{
ges->wait_for_keys = false;
@@ -133,11 +142,11 @@ get_exchange_run (void *cls,
}
ges->is = is;
ges->exchange
- = TALER_EXCHANGE_connect (TALER_TESTING_interpreter_get_context (is),
- ges->exchange_url,
- &cert_cb,
- ges,
- TALER_EXCHANGE_OPTION_END);
+ = TALER_EXCHANGE_get_keys (TALER_TESTING_interpreter_get_context (is),
+ ges->exchange_url,
+ NULL,
+ &cert_cb,
+ ges);
if (NULL == ges->exchange)
{
GNUNET_break (0);
@@ -163,9 +172,11 @@ get_exchange_cleanup (void *cls,
if (NULL != ges->exchange)
{
- TALER_EXCHANGE_disconnect (ges->exchange);
+ TALER_EXCHANGE_get_keys_cancel (ges->exchange);
ges->exchange = NULL;
}
+ TALER_EXCHANGE_keys_decref (ges->keys);
+ ges->keys = NULL;
GNUNET_free (ges->master_priv_file);
GNUNET_free (ges->exchange_url);
GNUNET_free (ges);
@@ -189,16 +200,13 @@ get_exchange_traits (void *cls,
{
struct GetExchangeState *ges = cls;
unsigned int off = (NULL == ges->master_priv_file) ? 1 : 0;
- struct TALER_EXCHANGE_Keys *keys
- = TALER_EXCHANGE_get_keys (ges->exchange);
- if (NULL != keys)
+ if (NULL != ges->keys)
{
struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_master_priv (&ges->master_priv),
- TALER_TESTING_make_trait_master_pub (&keys->master_pub),
- TALER_TESTING_make_trait_exchange (ges->exchange),
- TALER_TESTING_make_trait_keys (keys),
+ TALER_TESTING_make_trait_master_pub (&ges->keys->master_pub),
+ TALER_TESTING_make_trait_keys (ges->keys),
TALER_TESTING_make_trait_exchange_url (ges->exchange_url),
TALER_TESTING_trait_end ()
};
@@ -212,7 +220,6 @@ get_exchange_traits (void *cls,
{
struct TALER_TESTING_Trait traits[] = {
TALER_TESTING_make_trait_master_priv (&ges->master_priv),
- TALER_TESTING_make_trait_exchange (ges->exchange),
TALER_TESTING_make_trait_exchange_url (ges->exchange_url),
TALER_TESTING_trait_end ()
};
diff --git a/src/testing/testing_api_cmd_purse_deposit.c b/src/testing/testing_api_cmd_purse_deposit.c
index 8bddc53a6..eafe33423 100644
--- a/src/testing/testing_api_cmd_purse_deposit.c
+++ b/src/testing/testing_api_cmd_purse_deposit.c
@@ -133,11 +133,8 @@ deposit_cb (void *cls,
const struct TALER_EXCHANGE_PurseDepositResponse *dr)
{
struct PurseDepositState *ds = cls;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (ds->is);
ds->dh = NULL;
- GNUNET_assert (NULL != exchange);
if (ds->expected_response_code != dr->hr.http_status)
{
TALER_TESTING_unexpected_status (ds->is,
@@ -197,10 +194,10 @@ deposit_cb (void *cls,
/* Deposits complete, create trait! */
ds->reserve_history.type = TALER_EXCHANGE_RTT_MERGE;
{
- const struct TALER_EXCHANGE_Keys *keys;
+ struct TALER_EXCHANGE_Keys *keys;
const struct TALER_EXCHANGE_GlobalFee *gf;
- keys = TALER_EXCHANGE_get_keys (exchange);
+ keys = TALER_TESTING_get_keys (ds->is);
GNUNET_assert (NULL != keys);
gf = TALER_EXCHANGE_get_global_fee (keys,
*merge_timestamp);
diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c
index dfaf31fd4..6449c538c 100644
--- a/src/testing/testing_api_cmd_refresh.c
+++ b/src/testing/testing_api_cmd_refresh.c
@@ -371,12 +371,8 @@ reveal_cb (void *cls,
struct RefreshRevealState *rrs = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &rr->hr;
const struct TALER_TESTING_Command *melt_cmd;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (rrs->is);
rrs->rrh = NULL;
- if (NULL == exchange)
- return;
if (rrs->expected_response_code != hr->http_status)
{
if (0 != rrs->do_retry)
@@ -1006,12 +1002,8 @@ melt_run (void *cls,
NULL
};
const char **melt_fresh_amounts;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
rms->cmd = cmd;
- if (NULL == exchange)
- return;
if (NULL == (melt_fresh_amounts = rms->melt_fresh_amounts))
melt_fresh_amounts = default_melt_fresh_amounts;
rms->is = is;
@@ -1115,7 +1107,7 @@ melt_run (void *cls,
TALER_TESTING_interpreter_fail (rms->is);
return;
}
- fresh_pk = TALER_TESTING_find_pk (TALER_EXCHANGE_get_keys (exchange),
+ fresh_pk = TALER_TESTING_find_pk (TALER_TESTING_get_keys (rms->is),
&fresh_amount,
age_restricted);
if (NULL == fresh_pk)
diff --git a/src/testing/testing_api_cmd_reserve_history.c b/src/testing/testing_api_cmd_reserve_history.c
index 6e68bbe26..a7df69e6e 100644
--- a/src/testing/testing_api_cmd_reserve_history.c
+++ b/src/testing/testing_api_cmd_reserve_history.c
@@ -230,19 +230,15 @@ reserve_history_cb (void *cls,
struct HistoryState *ss = cls;
struct TALER_TESTING_Interpreter *is = ss->is;
struct TALER_Amount eb;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
ss->rsh = NULL;
- if (NULL == exchange)
- return;
if (MHD_HTTP_OK == rs->hr.http_status)
{
- const struct TALER_EXCHANGE_Keys *keys;
+ struct TALER_EXCHANGE_Keys *keys;
const struct TALER_EXCHANGE_GlobalFee *gf;
ss->reserve_history.type = TALER_EXCHANGE_RTT_HISTORY;
- keys = TALER_EXCHANGE_get_keys (exchange);
+ keys = TALER_TESTING_get_keys (is);
GNUNET_assert (NULL != keys);
gf = TALER_EXCHANGE_get_global_fee (keys,
rs->ts);
@@ -343,11 +339,7 @@ history_run (void *cls,
{
struct HistoryState *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,
diff --git a/src/testing/testing_api_cmd_reserve_open.c b/src/testing/testing_api_cmd_reserve_open.c
index a78662c33..189d06b26 100644
--- a/src/testing/testing_api_cmd_reserve_open.c
+++ b/src/testing/testing_api_cmd_reserve_open.c
@@ -165,11 +165,7 @@ open_run (void *cls,
struct OpenState *ss = cls;
const struct TALER_TESTING_Command *create_reserve;
struct TALER_EXCHANGE_PurseDeposit cp[GNUNET_NZL (ss->cpl)];
- 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,
diff --git a/src/testing/testing_api_cmd_reserve_purse.c b/src/testing/testing_api_cmd_reserve_purse.c
index 7a356c231..511e2d498 100644
--- a/src/testing/testing_api_cmd_reserve_purse.c
+++ b/src/testing/testing_api_cmd_reserve_purse.c
@@ -184,12 +184,8 @@ purse_run (void *cls,
struct ReservePurseState *ds = cls;
const struct TALER_ReservePrivateKeyP *reserve_priv;
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->reserve_ref);
diff --git a/src/testing/testing_api_cmd_reserve_status.c b/src/testing/testing_api_cmd_reserve_status.c
index 2da1bf740..001582ed8 100644
--- a/src/testing/testing_api_cmd_reserve_status.c
+++ b/src/testing/testing_api_cmd_reserve_status.c
@@ -314,11 +314,7 @@ status_run (void *cls,
{
struct StatusState *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,
diff --git a/src/testing/testing_api_cmd_serialize_keys.c b/src/testing/testing_api_cmd_serialize_keys.c
index 9e5a25c4c..13464dffd 100644
--- a/src/testing/testing_api_cmd_serialize_keys.c
+++ b/src/testing/testing_api_cmd_serialize_keys.c
@@ -58,12 +58,12 @@ serialize_keys_run (void *cls,
struct TALER_TESTING_Interpreter *is)
{
struct SerializeKeysState *sks = cls;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
+ struct TALER_EXCHANGE_Keys *keys
+ = TALER_TESTING_get_keys (is);
- if (NULL == exchange)
+ if (NULL == keys)
return;
- sks->keys = TALER_EXCHANGE_serialize_data (exchange);
+ sks->keys = TALER_EXCHANGE_keys_to_json (keys);
if (NULL == sks->keys)
{
GNUNET_break (0);
@@ -71,7 +71,7 @@ serialize_keys_run (void *cls,
}
sks->exchange_url
= GNUNET_strdup (
- TALER_EXCHANGE_get_base_url (exchange));
+ TALER_TESTING_get_exchange_url (is));
TALER_TESTING_interpreter_next (is);
}
diff --git a/src/testing/testing_api_cmd_transfer_get.c b/src/testing/testing_api_cmd_transfer_get.c
index 37fe736ba..da3585d6c 100644
--- a/src/testing/testing_api_cmd_transfer_get.c
+++ b/src/testing/testing_api_cmd_transfer_get.c
@@ -309,12 +309,8 @@ track_transfer_run (void *cls,
struct TrackTransferState *tts = cls;
struct TALER_WireTransferIdentifierRawP wtid;
const struct TALER_WireTransferIdentifierRawP *wtid_ptr;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
tts->cmd = cmd;
- if (NULL == exchange)
- return;
/* If no reference is given, we'll use a all-zeros
* WTID */
memset (&wtid,
diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c
index a6315f91e..3e735ad01 100644
--- a/src/testing/testing_api_cmd_withdraw.c
+++ b/src/testing/testing_api_cmd_withdraw.c
@@ -347,7 +347,6 @@ withdraw_run (void *cls,
const struct TALER_ReservePrivateKeyP *rp;
const struct TALER_TESTING_Command *create_reserve;
const struct TALER_EXCHANGE_DenomPublicKey *dpk;
- struct TALER_EXCHANGE_Handle *exchange;
ws->cmd = cmd;
ws->is = is;
@@ -369,12 +368,9 @@ withdraw_run (void *cls,
TALER_TESTING_interpreter_fail (is);
return;
}
- exchange = TALER_TESTING_get_exchange (is);
- if (NULL == exchange)
- return;
if (NULL == ws->exchange_url)
ws->exchange_url
- = GNUNET_strdup (TALER_EXCHANGE_get_base_url (exchange));
+ = GNUNET_strdup (TALER_TESTING_get_exchange_url (is));
ws->reserve_priv = *rp;
GNUNET_CRYPTO_eddsa_key_get_public (&ws->reserve_priv.eddsa_priv,
&ws->reserve_pub.eddsa_pub);
diff --git a/src/testing/testing_api_traits.c b/src/testing/testing_api_traits.c
index d00a8d8ca..799ae6718 100644
--- a/src/testing/testing_api_traits.c
+++ b/src/testing/testing_api_traits.c
@@ -75,33 +75,6 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
}
-struct TALER_EXCHANGE_Handle *
-TALER_TESTING_get_exchange (struct TALER_TESTING_Interpreter *is)
-{
- struct TALER_EXCHANGE_Handle *exchange;
- const struct TALER_TESTING_Command *exchange_cmd;
-
- exchange_cmd
- = TALER_TESTING_interpreter_get_command (is,
- "exchange");
- if (NULL == exchange_cmd)
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (is);
- return NULL;
- }
- if (GNUNET_OK !=
- TALER_TESTING_get_trait_exchange (exchange_cmd,
- &exchange))
- {
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (is);
- return NULL;
- }
- return exchange;
-}
-
-
const char *
TALER_TESTING_get_exchange_url (struct TALER_TESTING_Interpreter *is)
{