sort out URL types more nicely
This commit is contained in:
parent
fad5a22680
commit
90c411bc19
@ -2351,6 +2351,29 @@ TALER_TESTING_make_trait_wtid (unsigned int index,
|
|||||||
TALER_WireTransferIdentifierRawP *wtid);
|
TALER_WireTransferIdentifierRawP *wtid);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Different types of URLs that appear in traits.
|
||||||
|
*/
|
||||||
|
enum TALER_TESTING_URL_Type
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Category of last resort. Should not be used.
|
||||||
|
*/
|
||||||
|
TALER_TESTING_UT_UNDEFINED = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP base URL of an exchange (API), as for example
|
||||||
|
* given in wire transfers subjects made by the aggregator.
|
||||||
|
*/
|
||||||
|
TALER_TESTING_UT_EXCHANGE_BASE_URL = 1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP URL of the exchange's bank account at the bank.
|
||||||
|
*/
|
||||||
|
TALER_TESTING_UT_EXCHANGE_BANK_ACCOUNT_URL = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offer HTTP url in a trait.
|
* Offer HTTP url in a trait.
|
||||||
*
|
*
|
||||||
@ -2360,7 +2383,7 @@ TALER_TESTING_make_trait_wtid (unsigned int index,
|
|||||||
* @return the trait.
|
* @return the trait.
|
||||||
*/
|
*/
|
||||||
struct TALER_TESTING_Trait
|
struct TALER_TESTING_Trait
|
||||||
TALER_TESTING_make_trait_url (unsigned int index,
|
TALER_TESTING_make_trait_url (enum TALER_TESTING_URL_Type index,
|
||||||
const char *url);
|
const char *url);
|
||||||
|
|
||||||
|
|
||||||
@ -2375,7 +2398,7 @@ TALER_TESTING_make_trait_url (unsigned int index,
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
TALER_TESTING_get_trait_url (const struct TALER_TESTING_Command *cmd,
|
TALER_TESTING_get_trait_url (const struct TALER_TESTING_Command *cmd,
|
||||||
unsigned int index,
|
enum TALER_TESTING_URL_Type index,
|
||||||
const char **url);
|
const char **url);
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ TALER_EXCHANGE_verify_coin_history (const struct
|
|||||||
&dr.deposit_fee);
|
&dr.deposit_fee);
|
||||||
if ( (GNUNET_YES !=
|
if ( (GNUNET_YES !=
|
||||||
TALER_amount_cmp_currency (&fee,
|
TALER_amount_cmp_currency (&fee,
|
||||||
&dki->fee_deposit)) ||
|
&dk->fee_deposit)) ||
|
||||||
(0 !=
|
(0 !=
|
||||||
TALER_amount_cmp (&fee,
|
TALER_amount_cmp (&fee,
|
||||||
&dk->fee_deposit)) )
|
&dk->fee_deposit)) )
|
||||||
@ -193,7 +193,7 @@ TALER_EXCHANGE_verify_coin_history (const struct
|
|||||||
&rm.melt_fee);
|
&rm.melt_fee);
|
||||||
if ( (GNUNET_YES !=
|
if ( (GNUNET_YES !=
|
||||||
TALER_amount_cmp_currency (&fee,
|
TALER_amount_cmp_currency (&fee,
|
||||||
&dki->fee_refresh)) ||
|
&dk->fee_refresh)) ||
|
||||||
(0 !=
|
(0 !=
|
||||||
TALER_amount_cmp (&fee,
|
TALER_amount_cmp (&fee,
|
||||||
&dk->fee_refresh)) )
|
&dk->fee_refresh)) )
|
||||||
@ -257,7 +257,7 @@ TALER_EXCHANGE_verify_coin_history (const struct
|
|||||||
&rr.refund_fee);
|
&rr.refund_fee);
|
||||||
if ( (GNUNET_YES !=
|
if ( (GNUNET_YES !=
|
||||||
TALER_amount_cmp_currency (&fee,
|
TALER_amount_cmp_currency (&fee,
|
||||||
&dki->fee_refund)) ||
|
&dk->fee_refund)) ||
|
||||||
(0 !=
|
(0 !=
|
||||||
TALER_amount_cmp (&fee,
|
TALER_amount_cmp (&fee,
|
||||||
&dk->fee_refund)) )
|
&dk->fee_refund)) )
|
||||||
|
@ -409,7 +409,8 @@ admin_add_incoming_traits (void *cls,
|
|||||||
fts->payto_debit_account),
|
fts->payto_debit_account),
|
||||||
TALER_TESTING_make_trait_payto (TALER_TESTING_PT_CREDIT,
|
TALER_TESTING_make_trait_payto (TALER_TESTING_PT_CREDIT,
|
||||||
fts->payto_credit_account),
|
fts->payto_credit_account),
|
||||||
TALER_TESTING_make_trait_url (0, fts->exchange_credit_url),
|
TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BANK_ACCOUNT_URL,
|
||||||
|
fts->exchange_credit_url),
|
||||||
TALER_TESTING_make_trait_amount_obj (0, &fts->amount),
|
TALER_TESTING_make_trait_amount_obj (0, &fts->amount),
|
||||||
TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
|
TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
|
||||||
TALER_TESTING_make_trait_reserve_priv (0,
|
TALER_TESTING_make_trait_reserve_priv (0,
|
||||||
|
@ -124,29 +124,29 @@ check_bank_transfer_run (void *cls,
|
|||||||
(is),
|
(is),
|
||||||
bcs->deposit_reference,
|
bcs->deposit_reference,
|
||||||
bcs->deposit_reference);
|
bcs->deposit_reference);
|
||||||
deposit_cmd = TALER_TESTING_interpreter_lookup_command
|
deposit_cmd
|
||||||
(is, bcs->deposit_reference);
|
= TALER_TESTING_interpreter_lookup_command (is,
|
||||||
|
bcs->deposit_reference);
|
||||||
if (NULL == deposit_cmd)
|
if (NULL == deposit_cmd)
|
||||||
TALER_TESTING_FAIL (is);
|
TALER_TESTING_FAIL (is);
|
||||||
|
if ( (GNUNET_OK !=
|
||||||
GNUNET_assert (GNUNET_OK ==
|
|
||||||
TALER_TESTING_get_trait_amount_obj (deposit_cmd,
|
TALER_TESTING_get_trait_amount_obj (deposit_cmd,
|
||||||
0,
|
0,
|
||||||
&amount_ptr));
|
&amount_ptr)) ||
|
||||||
amount = *amount_ptr;
|
(GNUNET_OK !=
|
||||||
GNUNET_assert (GNUNET_OK ==
|
|
||||||
TALER_TESTING_get_trait_payto (deposit_cmd,
|
TALER_TESTING_get_trait_payto (deposit_cmd,
|
||||||
TALER_TESTING_PT_DEBIT,
|
TALER_TESTING_PT_DEBIT,
|
||||||
&debit_payto));
|
&debit_payto)) ||
|
||||||
GNUNET_assert (GNUNET_OK ==
|
(GNUNET_OK !=
|
||||||
TALER_TESTING_get_trait_payto (deposit_cmd,
|
TALER_TESTING_get_trait_payto (deposit_cmd,
|
||||||
TALER_TESTING_PT_CREDIT,
|
TALER_TESTING_PT_CREDIT,
|
||||||
&credit_payto));
|
&credit_payto)) ||
|
||||||
GNUNET_assert (GNUNET_OK ==
|
(GNUNET_OK !=
|
||||||
TALER_TESTING_get_trait_url (deposit_cmd,
|
TALER_TESTING_get_trait_url (deposit_cmd,
|
||||||
0, /* TODO: check 0 works! */
|
TALER_TESTING_UT_EXCHANGE_BASE_URL,
|
||||||
&exchange_base_url));
|
&exchange_base_url)) )
|
||||||
|
TALER_TESTING_FAIL (is);
|
||||||
|
amount = *amount_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -218,8 +218,10 @@ check_bank_transfer_traits (void *cls,
|
|||||||
struct BankCheckState *bcs = cls;
|
struct BankCheckState *bcs = cls;
|
||||||
struct TALER_WireTransferIdentifierRawP *wtid_ptr = &bcs->wtid;
|
struct TALER_WireTransferIdentifierRawP *wtid_ptr = &bcs->wtid;
|
||||||
struct TALER_TESTING_Trait traits[] = {
|
struct TALER_TESTING_Trait traits[] = {
|
||||||
TALER_TESTING_make_trait_wtid (0, wtid_ptr),
|
TALER_TESTING_make_trait_wtid (0,
|
||||||
TALER_TESTING_make_trait_url (0, bcs->exchange_base_url),
|
wtid_ptr),
|
||||||
|
TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BASE_URL,
|
||||||
|
bcs->exchange_base_url),
|
||||||
TALER_TESTING_trait_end ()
|
TALER_TESTING_trait_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ build_history (struct TALER_TESTING_Interpreter *is,
|
|||||||
&reserve_pub)) ||
|
&reserve_pub)) ||
|
||||||
(GNUNET_OK !=
|
(GNUNET_OK !=
|
||||||
TALER_TESTING_get_trait_url (cmd,
|
TALER_TESTING_get_trait_url (cmd,
|
||||||
0,
|
TALER_TESTING_UT_EXCHANGE_BANK_ACCOUNT_URL,
|
||||||
&exchange_credit_url)) )
|
&exchange_credit_url)) )
|
||||||
continue; /* not an interesting event */
|
continue; /* not an interesting event */
|
||||||
/* Seek "/history" starting row. */
|
/* Seek "/history" starting row. */
|
||||||
|
@ -285,7 +285,7 @@ build_history (struct TALER_TESTING_Interpreter *is,
|
|||||||
&wtid)) ||
|
&wtid)) ||
|
||||||
(GNUNET_OK !=
|
(GNUNET_OK !=
|
||||||
TALER_TESTING_get_trait_url (cmd,
|
TALER_TESTING_get_trait_url (cmd,
|
||||||
0,
|
TALER_TESTING_UT_EXCHANGE_BASE_URL,
|
||||||
&exchange_base_url)) )
|
&exchange_base_url)) )
|
||||||
continue; /* not an event we care about */
|
continue; /* not an event we care about */
|
||||||
/* Seek "/history" starting row. */
|
/* Seek "/history" starting row. */
|
||||||
|
@ -308,7 +308,7 @@ transfer_traits (void *cls,
|
|||||||
{
|
{
|
||||||
struct TransferState *fts = cls;
|
struct TransferState *fts = cls;
|
||||||
struct TALER_TESTING_Trait traits[] = {
|
struct TALER_TESTING_Trait traits[] = {
|
||||||
TALER_TESTING_make_trait_url (0,
|
TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BASE_URL,
|
||||||
fts->exchange_base_url),
|
fts->exchange_base_url),
|
||||||
TALER_TESTING_make_trait_bank_row (&fts->serial_id),
|
TALER_TESTING_make_trait_bank_row (&fts->serial_id),
|
||||||
TALER_TESTING_make_trait_payto (TALER_TESTING_PT_CREDIT,
|
TALER_TESTING_make_trait_payto (TALER_TESTING_PT_CREDIT,
|
||||||
|
@ -144,7 +144,8 @@ serialize_keys_traits (void *cls,
|
|||||||
struct SerializeKeysState *sks = cls;
|
struct SerializeKeysState *sks = cls;
|
||||||
struct TALER_TESTING_Trait traits[] = {
|
struct TALER_TESTING_Trait traits[] = {
|
||||||
TALER_TESTING_make_trait_exchange_keys (0, sks->keys),
|
TALER_TESTING_make_trait_exchange_keys (0, sks->keys),
|
||||||
TALER_TESTING_make_trait_url (0, sks->exchange_url),
|
TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BASE_URL,
|
||||||
|
sks->exchange_url),
|
||||||
TALER_TESTING_trait_end ()
|
TALER_TESTING_trait_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -192,12 +193,10 @@ connect_with_state_run (void *cls,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GNUNET_assert
|
GNUNET_assert (GNUNET_OK ==
|
||||||
(GNUNET_OK == TALER_TESTING_get_trait_exchange_keys
|
TALER_TESTING_get_trait_exchange_keys (state_cmd,
|
||||||
(state_cmd,
|
|
||||||
0,
|
0,
|
||||||
&serialized_keys));
|
&serialized_keys));
|
||||||
|
|
||||||
{
|
{
|
||||||
char *dump;
|
char *dump;
|
||||||
|
|
||||||
@ -208,21 +207,17 @@ connect_with_state_run (void *cls,
|
|||||||
free (dump);
|
free (dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
GNUNET_assert
|
GNUNET_assert (GNUNET_OK ==
|
||||||
(GNUNET_OK == TALER_TESTING_get_trait_url
|
TALER_TESTING_get_trait_url (state_cmd,
|
||||||
(state_cmd,
|
TALER_TESTING_UT_EXCHANGE_BASE_URL,
|
||||||
0,
|
|
||||||
&exchange_url));
|
&exchange_url));
|
||||||
|
is->exchange = TALER_EXCHANGE_connect (is->ctx,
|
||||||
is->exchange = TALER_EXCHANGE_connect
|
|
||||||
(is->ctx,
|
|
||||||
exchange_url,
|
exchange_url,
|
||||||
TALER_TESTING_cert_cb,
|
TALER_TESTING_cert_cb,
|
||||||
cwss,
|
cwss,
|
||||||
TALER_EXCHANGE_OPTION_DATA,
|
TALER_EXCHANGE_OPTION_DATA,
|
||||||
serialized_keys,
|
serialized_keys,
|
||||||
TALER_EXCHANGE_OPTION_END);
|
TALER_EXCHANGE_OPTION_END);
|
||||||
|
|
||||||
cwss->consumed = GNUNET_YES;
|
cwss->consumed = GNUNET_YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,8 +230,7 @@ connect_with_state_run (void *cls,
|
|||||||
* @param cmd the command which is being cleaned up.
|
* @param cmd the command which is being cleaned up.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
connect_with_state_cleanup
|
connect_with_state_cleanup (void *cls,
|
||||||
(void *cls,
|
|
||||||
const struct TALER_TESTING_Command *cmd)
|
const struct TALER_TESTING_Command *cmd)
|
||||||
{
|
{
|
||||||
struct ConnectWithStateState *cwss = cls;
|
struct ConnectWithStateState *cwss = cls;
|
||||||
|
@ -385,7 +385,7 @@ withdraw_traits (void *cls,
|
|||||||
if (NULL == ws->exchange_url)
|
if (NULL == ws->exchange_url)
|
||||||
ws->exchange_url
|
ws->exchange_url
|
||||||
= GNUNET_strdup (TALER_EXCHANGE_get_base_url (ws->is->exchange));
|
= GNUNET_strdup (TALER_EXCHANGE_get_base_url (ws->is->exchange));
|
||||||
|
{
|
||||||
struct TALER_TESTING_Trait traits[] = {
|
struct TALER_TESTING_Trait traits[] = {
|
||||||
TALER_TESTING_make_trait_coin_priv (0 /* only one coin */,
|
TALER_TESTING_make_trait_coin_priv (0 /* only one coin */,
|
||||||
&ws->ps.coin_priv),
|
&ws->ps.coin_priv),
|
||||||
@ -401,7 +401,8 @@ withdraw_traits (void *cls,
|
|||||||
reserve_pub),
|
reserve_pub),
|
||||||
TALER_TESTING_make_trait_amount_obj (0,
|
TALER_TESTING_make_trait_amount_obj (0,
|
||||||
&ws->amount),
|
&ws->amount),
|
||||||
TALER_TESTING_make_trait_url (0, ws->exchange_url),
|
TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BASE_URL,
|
||||||
|
ws->exchange_url),
|
||||||
TALER_TESTING_trait_end ()
|
TALER_TESTING_trait_end ()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -409,6 +410,7 @@ withdraw_traits (void *cls,
|
|||||||
ret,
|
ret,
|
||||||
trait,
|
trait,
|
||||||
index);
|
index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user