implemented reserve_open testing CMD

This commit is contained in:
Christian Grothoff 2022-09-28 12:17:50 +02:00
parent 58e7e98657
commit 3f901571d5
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 11 additions and 12 deletions

View File

@ -9,6 +9,6 @@ if ! uncrustify --version >/dev/null; then
exit 1 exit 1
fi fi
find "$DIR/../src" \( -name "*.cpp" -o -name "*.c" -o -name "*.h" \) \ find "$DIR/../src" \( -name "*.cpp" -o -name "*.c" -o -name "*.h" \) | grep -v mustach \
-exec uncrustify -c "$DIR/uncrustify.cfg" --replace --no-backup {} + \ -exec uncrustify -c "$DIR/uncrustify.cfg" --replace --no-backup {} + \
|| true || true

View File

@ -87,6 +87,7 @@ libtalertesting_la_SOURCES = \
testing_api_cmd_refresh.c \ testing_api_cmd_refresh.c \
testing_api_cmd_reserve_get.c \ testing_api_cmd_reserve_get.c \
testing_api_cmd_reserve_history.c \ testing_api_cmd_reserve_history.c \
testing_api_cmd_reserve_open.c \
testing_api_cmd_reserve_purse.c \ testing_api_cmd_reserve_purse.c \
testing_api_cmd_reserve_status.c \ testing_api_cmd_reserve_status.c \
testing_api_cmd_revoke.c \ testing_api_cmd_revoke.c \

View File

@ -36,7 +36,7 @@ struct CoinDetail
/** /**
* Name of the command and index of the coin to use. * Name of the command and index of the coin to use.
*/ */
char *name; const char *name;
/** /**
* Amount to charge to this coin. * Amount to charge to this coin.
@ -122,11 +122,10 @@ struct OpenState
*/ */
static void static void
reserve_open_cb (void *cls, reserve_open_cb (void *cls,
const struct TALER_EXCHANGE_ReserveOpen *rs) const struct TALER_EXCHANGE_ReserveOpenResult *rs)
{ {
struct OpenState *ss = cls; struct OpenState *ss = cls;
struct TALER_TESTING_Interpreter *is = ss->is; struct TALER_TESTING_Interpreter *is = ss->is;
struct TALER_Amount eb;
ss->rsh = NULL; ss->rsh = NULL;
if (ss->expected_response_code != rs->hr.http_status) if (ss->expected_response_code != rs->hr.http_status)
@ -192,7 +191,7 @@ open_run (void *cls,
for (unsigned int i = 0; i<ss->cpl; i++) for (unsigned int i = 0; i<ss->cpl; i++)
{ {
struct TALER_EXCHANGE_PurseDeposit *cpi = &cp[i]; struct TALER_EXCHANGE_PurseDeposit *cpi = &cp[i];
struct TALER_TESTING_Command *cmdi; const struct TALER_TESTING_Command *cmdi;
const struct TALER_AgeCommitmentProof *age_commitment_proof; const struct TALER_AgeCommitmentProof *age_commitment_proof;
const struct TALER_CoinSpendPrivateKeyP *coin_priv; const struct TALER_CoinSpendPrivateKeyP *coin_priv;
const struct TALER_DenominationSignature *denom_sig; const struct TALER_DenominationSignature *denom_sig;
@ -232,9 +231,9 @@ open_run (void *cls,
cidx, cidx,
&coin_priv)) || &coin_priv)) ||
(GNUNET_OK != (GNUNET_OK !=
TALER_TESTING_get_trait_denom_sig_priv (cmdi, TALER_TESTING_get_trait_denom_sig (cmdi,
cidx, cidx,
&denom_sig)) || &denom_sig)) ||
(GNUNET_OK != (GNUNET_OK !=
TALER_TESTING_get_trait_denom_pub (cmdi, TALER_TESTING_get_trait_denom_pub (cmdi,
cidx, cidx,
@ -246,12 +245,11 @@ open_run (void *cls,
TALER_TESTING_interpreter_fail (is); TALER_TESTING_interpreter_fail (is);
return; return;
} }
TALER_denom_pub_hash (denom_pub,
&cpi->h_denom_pub);
cpi->age_commitment_proof = age_commitment_proof; cpi->age_commitment_proof = age_commitment_proof;
cpi->coin_priv = *coin_priv; cpi->coin_priv = *coin_priv;
cpi->denom_sig = *denom_sig; cpi->denom_sig = *denom_sig;
cpi->amount = ss->cd[i].amount; cpi->amount = ss->cd[i].amount;
cpi->h_denom_pub = denom_pub->h_key;
} }
ss->rsh = TALER_EXCHANGE_reserves_open ( ss->rsh = TALER_EXCHANGE_reserves_open (
is->exchange, is->exchange,
@ -328,11 +326,11 @@ TALER_TESTING_cmd_reserve_open (const char *label,
expected_response_code); expected_response_code);
while (NULL != (name = va_arg (ap, const char *))) while (NULL != (name = va_arg (ap, const char *)))
{ {
ap[i].name = name; ss->cd[i].name = name;
GNUNET_assert (GNUNET_OK == GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (va_arg (ap, TALER_string_to_amount (va_arg (ap,
const char *), const char *),
&ap[i].amount)); &ss->cd[i].amount));
i++; i++;
} }
va_end (ap); va_end (ap);