aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/test_bank_api.c3
-rw-r--r--src/testing/test_exchange_api.c1
-rw-r--r--src/testing/testing_api_cmd_auditor_add.c3
-rw-r--r--src/testing/testing_api_cmd_auditor_add_denom_sig.c3
-rw-r--r--src/testing/testing_api_cmd_auditor_del.c3
-rw-r--r--src/testing/testing_api_cmd_auditor_deposit_confirmation.c3
-rw-r--r--src/testing/testing_api_cmd_auditor_exchanges.c3
-rw-r--r--src/testing/testing_api_cmd_bank_transfer.c3
-rw-r--r--src/testing/testing_api_cmd_batch_deposit.c3
-rw-r--r--src/testing/testing_api_cmd_batch_withdraw.c40
-rw-r--r--src/testing/testing_api_cmd_check_aml_decision.c3
-rw-r--r--src/testing/testing_api_cmd_check_aml_decisions.c3
-rw-r--r--src/testing/testing_api_cmd_contract_get.c3
-rw-r--r--src/testing/testing_api_cmd_deposit.c41
-rw-r--r--src/testing/testing_api_cmd_deposits_get.c3
-rw-r--r--src/testing/testing_api_cmd_get_auditor.c3
-rw-r--r--src/testing/testing_api_cmd_kyc_check_get.c3
-rw-r--r--src/testing/testing_api_cmd_kyc_proof.c3
-rw-r--r--src/testing/testing_api_cmd_kyc_wallet_get.c3
-rw-r--r--src/testing/testing_api_cmd_purse_create_deposit.c3
-rw-r--r--src/testing/testing_api_cmd_purse_delete.c3
-rw-r--r--src/testing/testing_api_cmd_purse_deposit.c3
-rw-r--r--src/testing/testing_api_cmd_purse_merge.c3
-rw-r--r--src/testing/testing_api_cmd_recoup.c3
-rw-r--r--src/testing/testing_api_cmd_recoup_refresh.c3
-rw-r--r--src/testing/testing_api_cmd_refresh.c57
-rw-r--r--src/testing/testing_api_cmd_refund.c3
-rw-r--r--src/testing/testing_api_cmd_reserve_purse.c3
-rw-r--r--src/testing/testing_api_cmd_revoke_denom_key.c3
-rw-r--r--src/testing/testing_api_cmd_revoke_sign_key.c3
-rw-r--r--src/testing/testing_api_cmd_run_fakebank.c1
-rw-r--r--src/testing/testing_api_cmd_set_officer.c3
-rw-r--r--src/testing/testing_api_cmd_set_wire_fee.c3
-rw-r--r--src/testing/testing_api_cmd_take_aml_decision.c3
-rw-r--r--src/testing/testing_api_cmd_transfer_get.c3
-rw-r--r--src/testing/testing_api_cmd_wire_add.c3
-rw-r--r--src/testing/testing_api_cmd_wire_del.c4
-rw-r--r--src/testing/testing_api_cmd_withdraw.c43
38 files changed, 167 insertions, 113 deletions
diff --git a/src/testing/test_bank_api.c b/src/testing/test_bank_api.c
index e197b152..8f1fe296 100644
--- a/src/testing/test_bank_api.c
+++ b/src/testing/test_bank_api.c
@@ -78,6 +78,9 @@ run (void *cls,
case TALER_TESTING_BS_IBAN:
ssoptions = "-ns";
break;
+ default:
+ ssoptions = NULL;
+ break;
}
memset (&wtid,
42,
diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c
index 0ff9aa6e..21891350 100644
--- a/src/testing/test_exchange_api.c
+++ b/src/testing/test_exchange_api.c
@@ -660,7 +660,6 @@ run (void *cls,
"refresh-reveal-age-1",
MHD_HTTP_CONFLICT,
NULL),
-
TALER_TESTING_cmd_end ()
};
diff --git a/src/testing/testing_api_cmd_auditor_add.c b/src/testing/testing_api_cmd_auditor_add.c
index aaa95552..ac9c2c8f 100644
--- a/src/testing/testing_api_cmd_auditor_add.c
+++ b/src/testing/testing_api_cmd_auditor_add.c
@@ -76,7 +76,8 @@ auditor_add_cb (
if (ds->expected_response_code != hr->http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- hr->http_status);
+ hr->http_status,
+ ds->expected_response_code);
return;
}
TALER_TESTING_interpreter_next (ds->is);
diff --git a/src/testing/testing_api_cmd_auditor_add_denom_sig.c b/src/testing/testing_api_cmd_auditor_add_denom_sig.c
index 2df15fde..6b777689 100644
--- a/src/testing/testing_api_cmd_auditor_add_denom_sig.c
+++ b/src/testing/testing_api_cmd_auditor_add_denom_sig.c
@@ -81,7 +81,8 @@ denom_sig_add_cb (
if (ds->expected_response_code != hr->http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- hr->http_status);
+ hr->http_status,
+ ds->expected_response_code);
return;
}
TALER_TESTING_interpreter_next (ds->is);
diff --git a/src/testing/testing_api_cmd_auditor_del.c b/src/testing/testing_api_cmd_auditor_del.c
index df878f8e..8256bc1c 100644
--- a/src/testing/testing_api_cmd_auditor_del.c
+++ b/src/testing/testing_api_cmd_auditor_del.c
@@ -77,7 +77,8 @@ auditor_del_cb (
if (ds->expected_response_code != hr->http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- hr->http_status);
+ hr->http_status,
+ ds->expected_response_code);
return;
}
TALER_TESTING_interpreter_next (ds->is);
diff --git a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
index 252e8f52..1e5a6344 100644
--- a/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
+++ b/src/testing/testing_api_cmd_auditor_deposit_confirmation.c
@@ -170,7 +170,8 @@ deposit_confirmation_cb (
}
}
TALER_TESTING_unexpected_status (dcs->is,
- hr->http_status);
+ hr->http_status,
+ dcs->expected_response_code);
return;
}
TALER_TESTING_interpreter_next (dcs->is);
diff --git a/src/testing/testing_api_cmd_auditor_exchanges.c b/src/testing/testing_api_cmd_auditor_exchanges.c
index aa9a1bfb..29d3726a 100644
--- a/src/testing/testing_api_cmd_auditor_exchanges.c
+++ b/src/testing/testing_api_cmd_auditor_exchanges.c
@@ -160,7 +160,8 @@ exchanges_cb (void *cls,
}
}
TALER_TESTING_unexpected_status (es->is,
- hr->http_status);
+ hr->http_status,
+ es->expected_response_code);
return;
}
if (MHD_HTTP_OK != hr->http_status)
diff --git a/src/testing/testing_api_cmd_bank_transfer.c b/src/testing/testing_api_cmd_bank_transfer.c
index 7b9d588c..bfb29e12 100644
--- a/src/testing/testing_api_cmd_bank_transfer.c
+++ b/src/testing/testing_api_cmd_bank_transfer.c
@@ -199,7 +199,8 @@ confirmation_cb (void *cls,
}
}
TALER_TESTING_unexpected_status (is,
- tr->http_status);
+ tr->http_status,
+ MHD_HTTP_OK);
return;
}
diff --git a/src/testing/testing_api_cmd_batch_deposit.c b/src/testing/testing_api_cmd_batch_deposit.c
index 0a4fbd25..77bfd4d5 100644
--- a/src/testing/testing_api_cmd_batch_deposit.c
+++ b/src/testing/testing_api_cmd_batch_deposit.c
@@ -199,7 +199,8 @@ batch_deposit_cb (void *cls,
if (ds->expected_response_code != dr->hr.http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- dr->hr.http_status);
+ dr->hr.http_status,
+ ds->expected_response_code);
return;
}
if (MHD_HTTP_OK == dr->hr.http_status)
diff --git a/src/testing/testing_api_cmd_batch_withdraw.c b/src/testing/testing_api_cmd_batch_withdraw.c
index 7f680949..da43a9aa 100644
--- a/src/testing/testing_api_cmd_batch_withdraw.c
+++ b/src/testing/testing_api_cmd_batch_withdraw.c
@@ -79,10 +79,10 @@ struct CoinState
/**
* If age > 0, put here the corresponding age commitment with its proof and
- * its hash, respectivelly, NULL otherwise.
+ * its hash, respectivelly.
*/
- struct TALER_AgeCommitmentProof *age_commitment_proof;
- struct TALER_AgeCommitmentHash *h_age_commitment;
+ struct TALER_AgeCommitmentProof age_commitment_proof;
+ struct TALER_AgeCommitmentHash h_age_commitment;
/**
* Reserve history entry that corresponds to this coin.
@@ -190,7 +190,8 @@ reserve_batch_withdraw_cb (void *cls,
if (ws->expected_response_code != wr->hr.http_status)
{
TALER_TESTING_unexpected_status (is,
- wr->hr.http_status);
+ wr->hr.http_status,
+ ws->expected_response_code);
return;
}
switch (wr->hr.http_status)
@@ -315,7 +316,7 @@ batch_withdraw_run (void *cls,
wci->pk = cs->pk;
wci->ps = &cs->ps;
- wci->ach = cs->h_age_commitment;
+ wci->ach = &cs->h_age_commitment;
}
ws->wsh = TALER_EXCHANGE_batch_withdraw (
TALER_TESTING_interpreter_get_context (is),
@@ -365,13 +366,8 @@ batch_withdraw_cleanup (void *cls,
TALER_EXCHANGE_destroy_denomination_key (cs->pk);
cs->pk = NULL;
}
- if (NULL != cs->age_commitment_proof)
- {
- TALER_age_commitment_proof_free (cs->age_commitment_proof);
- cs->age_commitment_proof = NULL;
- }
- if (NULL != cs->h_age_commitment)
- GNUNET_free (cs->h_age_commitment);
+ if (0 < ws->age)
+ TALER_age_commitment_proof_free (&cs->age_commitment_proof);
}
GNUNET_free (ws->coins);
GNUNET_free (ws->exchange_url);
@@ -423,9 +419,13 @@ batch_withdraw_traits (void *cls,
TALER_TESTING_make_trait_payto_uri (ws->reserve_payto_uri),
TALER_TESTING_make_trait_exchange_url (ws->exchange_url),
TALER_TESTING_make_trait_age_commitment_proof (index,
- cs->age_commitment_proof),
+ ws->age > 0 ?
+ &cs->age_commitment_proof:
+ NULL),
TALER_TESTING_make_trait_h_age_commitment (index,
- cs->h_age_commitment),
+ ws->age > 0 ?
+ &cs->h_age_commitment :
+ NULL),
TALER_TESTING_trait_end ()
};
@@ -472,13 +472,9 @@ TALER_TESTING_cmd_batch_withdraw (const char *label,
if (0 < age)
{
- struct TALER_AgeCommitmentProof *acp;
- struct TALER_AgeCommitmentHash *hac;
struct GNUNET_HashCode seed;
struct TALER_AgeMask mask;
- acp = GNUNET_new (struct TALER_AgeCommitmentProof);
- hac = GNUNET_new (struct TALER_AgeCommitmentHash);
mask = TALER_extensions_get_age_restriction_mask ();
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&seed,
@@ -489,7 +485,7 @@ TALER_TESTING_cmd_batch_withdraw (const char *label,
&mask,
age,
&seed,
- acp))
+ &cs->age_commitment_proof))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to generate age commitment for age %d at %s\n",
@@ -498,10 +494,8 @@ TALER_TESTING_cmd_batch_withdraw (const char *label,
GNUNET_assert (0);
}
- TALER_age_commitment_hash (&acp->commitment,
- hac);
- cs->age_commitment_proof = acp;
- cs->h_age_commitment = hac;
+ TALER_age_commitment_hash (&cs->age_commitment_proof.commitment,
+ &cs->h_age_commitment);
}
if (GNUNET_OK !=
diff --git a/src/testing/testing_api_cmd_check_aml_decision.c b/src/testing/testing_api_cmd_check_aml_decision.c
index 1f0ada7b..fa0981e0 100644
--- a/src/testing/testing_api_cmd_check_aml_decision.c
+++ b/src/testing/testing_api_cmd_check_aml_decision.c
@@ -80,7 +80,8 @@ check_aml_decision_cb (void *cls,
if (ds->expected_http_status != adr->hr.http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- adr->hr.http_status);
+ adr->hr.http_status,
+ ds->expected_http_status);
return;
}
if (MHD_HTTP_OK == adr->hr.http_status)
diff --git a/src/testing/testing_api_cmd_check_aml_decisions.c b/src/testing/testing_api_cmd_check_aml_decisions.c
index 4d206485..c8c2ec3f 100644
--- a/src/testing/testing_api_cmd_check_aml_decisions.c
+++ b/src/testing/testing_api_cmd_check_aml_decisions.c
@@ -80,7 +80,8 @@ check_aml_decisions_cb (void *cls,
if (ds->expected_http_status != adr->hr.http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- adr->hr.http_status);
+ adr->hr.http_status,
+ ds->expected_http_status);
return;
}
TALER_TESTING_interpreter_next (ds->is);
diff --git a/src/testing/testing_api_cmd_contract_get.c b/src/testing/testing_api_cmd_contract_get.c
index 902ec4a4..fa83d83f 100644
--- a/src/testing/testing_api_cmd_contract_get.c
+++ b/src/testing/testing_api_cmd_contract_get.c
@@ -102,7 +102,8 @@ get_cb (void *cls,
if (ds->expected_response_code != dr->hr.http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- dr->hr.http_status);
+ dr->hr.http_status,
+ ds->expected_response_code);
return;
}
ref = TALER_TESTING_interpreter_lookup_command (ds->is,
diff --git a/src/testing/testing_api_cmd_deposit.c b/src/testing/testing_api_cmd_deposit.c
index f2a3a269..5c98f91a 100644
--- a/src/testing/testing_api_cmd_deposit.c
+++ b/src/testing/testing_api_cmd_deposit.c
@@ -248,8 +248,12 @@ deposit_cb (void *cls,
return;
}
}
- TALER_TESTING_unexpected_status (ds->is,
- dr->hr.http_status);
+ TALER_TESTING_unexpected_status_with_body (
+ ds->is,
+ dr->hr.http_status,
+ ds->expected_response_code,
+ dr->hr.reply);
+
return;
}
if (MHD_HTTP_OK == dr->hr.http_status)
@@ -280,8 +284,7 @@ deposit_run (void *cls,
const struct TALER_TESTING_Command *coin_cmd;
const struct TALER_CoinSpendPrivateKeyP *coin_priv;
struct TALER_CoinSpendPublicKeyP coin_pub;
- const struct TALER_AgeCommitmentProof *age_commitment_proof = NULL;
- struct TALER_AgeCommitmentHash h_age_commitment = {0};
+ const struct TALER_AgeCommitmentHash *phac;
const struct TALER_EXCHANGE_DenomPublicKey *denom_pub;
const struct TALER_DenominationSignature *denom_pub_sig;
struct TALER_CoinSpendSignatureP coin_sig;
@@ -385,9 +388,9 @@ deposit_run (void *cls,
ds->coin_index,
&coin_priv)) ||
(GNUNET_OK !=
- TALER_TESTING_get_trait_age_commitment_proof (coin_cmd,
- ds->coin_index,
- &age_commitment_proof)) ||
+ TALER_TESTING_get_trait_h_age_commitment (coin_cmd,
+ ds->coin_index,
+ &phac)) ||
(GNUNET_OK !=
TALER_TESTING_get_trait_denom_pub (coin_cmd,
ds->coin_index,
@@ -405,11 +408,6 @@ deposit_run (void *cls,
return;
}
- if (NULL != age_commitment_proof)
- {
- TALER_age_commitment_hash (&age_commitment_proof->commitment,
- &h_age_commitment);
- }
ds->deposit_fee = denom_pub->fees.deposit;
GNUNET_CRYPTO_eddsa_key_get_public (&coin_priv->eddsa_priv,
&coin_pub.eddsa_pub);
@@ -443,7 +441,7 @@ deposit_run (void *cls,
&denom_pub->fees.deposit,
&h_wire,
&h_contract_terms,
- &h_age_commitment,
+ phac,
NULL, /* FIXME #7270: add hash of extensions */
&denom_pub->h_key,
ds->wallet_timestamp,
@@ -456,11 +454,11 @@ deposit_run (void *cls,
{
struct TALER_EXCHANGE_CoinDepositDetail cdd = {
.amount = ds->amount,
- .h_age_commitment = h_age_commitment,
.coin_pub = coin_pub,
.coin_sig = coin_sig,
.denom_sig = *denom_pub_sig,
- .h_denom_pub = denom_pub->h_key
+ .h_denom_pub = denom_pub->h_key,
+ .h_age_commitment = {{{0}}},
};
struct TALER_EXCHANGE_DepositContractDetail dcd = {
.wire_deadline = ds->wire_deadline,
@@ -473,6 +471,9 @@ deposit_run (void *cls,
.refund_deadline = ds->refund_deadline
};
+ if (NULL != phac)
+ cdd.h_age_commitment = *phac;
+
ds->dh = TALER_EXCHANGE_batch_deposit (
TALER_TESTING_interpreter_get_context (is),
exchange_url,
@@ -547,6 +548,7 @@ deposit_traits (void *cls,
/* Will point to coin cmd internals. */
const struct TALER_CoinSpendPrivateKeyP *coin_spent_priv;
const struct TALER_AgeCommitmentProof *age_commitment_proof;
+ const struct TALER_AgeCommitmentHash *h_age_commitment;
if (GNUNET_YES != ds->command_initialized)
{
@@ -571,12 +573,17 @@ deposit_traits (void *cls,
(GNUNET_OK !=
TALER_TESTING_get_trait_age_commitment_proof (coin_cmd,
ds->coin_index,
- &age_commitment_proof)) )
+ &age_commitment_proof)) ||
+ (GNUNET_OK !=
+ TALER_TESTING_get_trait_h_age_commitment (coin_cmd,
+ ds->coin_index,
+ &h_age_commitment)) )
{
GNUNET_break (0);
TALER_TESTING_interpreter_fail (ds->is);
return GNUNET_NO;
}
+
{
struct TALER_TESTING_Trait traits[] = {
/* First two traits are only available if
@@ -590,6 +597,8 @@ deposit_traits (void *cls,
coin_spent_priv),
TALER_TESTING_make_trait_age_commitment_proof (0,
age_commitment_proof),
+ TALER_TESTING_make_trait_h_age_commitment (0,
+ h_age_commitment),
TALER_TESTING_make_trait_wire_details (ds->wire_details),
TALER_TESTING_make_trait_contract_terms (ds->contract_terms),
TALER_TESTING_make_trait_merchant_priv (&ds->merchant_priv),
diff --git a/src/testing/testing_api_cmd_deposits_get.c b/src/testing/testing_api_cmd_deposits_get.c
index 165af9b1..5d4436e2 100644
--- a/src/testing/testing_api_cmd_deposits_get.c
+++ b/src/testing/testing_api_cmd_deposits_get.c
@@ -117,7 +117,8 @@ deposit_wtid_cb (void *cls,
if (tts->expected_response_code != dr->hr.http_status)
{
TALER_TESTING_unexpected_status (is,
- dr->hr.http_status);
+ dr->hr.http_status,
+ tts->expected_response_code);
return;
}
switch (dr->hr.http_status)
diff --git a/src/testing/testing_api_cmd_get_auditor.c b/src/testing/testing_api_cmd_get_auditor.c
index e1ae8ba5..ab4e3266 100644
--- a/src/testing/testing_api_cmd_get_auditor.c
+++ b/src/testing/testing_api_cmd_get_auditor.c
@@ -83,7 +83,8 @@ version_cb (
if (MHD_HTTP_OK != vr->hr.http_status)
{
TALER_TESTING_unexpected_status (gas->is,
- vr->hr.http_status);
+ vr->hr.http_status,
+ MHD_HTTP_OK);
return;
}
if ( (NULL != gas->priv_file) &&
diff --git a/src/testing/testing_api_cmd_kyc_check_get.c b/src/testing/testing_api_cmd_kyc_check_get.c
index bbbd9214..25c7e98b 100644
--- a/src/testing/testing_api_cmd_kyc_check_get.c
+++ b/src/testing/testing_api_cmd_kyc_check_get.c
@@ -78,7 +78,8 @@ check_kyc_cb (void *cls,
if (kcg->expected_response_code != ks->http_status)
{
TALER_TESTING_unexpected_status (is,
- ks->http_status);
+ ks->http_status,
+ kcg->expected_response_code);
return;
}
switch (ks->http_status)
diff --git a/src/testing/testing_api_cmd_kyc_proof.c b/src/testing/testing_api_cmd_kyc_proof.c
index c0fe7495..b079fffc 100644
--- a/src/testing/testing_api_cmd_kyc_proof.c
+++ b/src/testing/testing_api_cmd_kyc_proof.c
@@ -88,7 +88,8 @@ proof_kyc_cb (void *cls,
if (kcg->expected_response_code != kpr->http_status)
{
TALER_TESTING_unexpected_status (is,
- kpr->http_status);
+ kpr->http_status,
+ kcg->expected_response_code);
return;
}
switch (kpr->http_status)
diff --git a/src/testing/testing_api_cmd_kyc_wallet_get.c b/src/testing/testing_api_cmd_kyc_wallet_get.c
index fa6edab2..ffb143ff 100644
--- a/src/testing/testing_api_cmd_kyc_wallet_get.c
+++ b/src/testing/testing_api_cmd_kyc_wallet_get.c
@@ -109,7 +109,8 @@ wallet_kyc_cb (void *cls,
if (kwg->expected_response_code != wkr->http_status)
{
TALER_TESTING_unexpected_status (is,
- wkr->http_status);
+ wkr->http_status,
+ kwg->expected_response_code);
return;
}
switch (wkr->http_status)
diff --git a/src/testing/testing_api_cmd_purse_create_deposit.c b/src/testing/testing_api_cmd_purse_create_deposit.c
index 36dbfbff..cf992946 100644
--- a/src/testing/testing_api_cmd_purse_create_deposit.c
+++ b/src/testing/testing_api_cmd_purse_create_deposit.c
@@ -163,7 +163,8 @@ deposit_cb (void *cls,
if (ds->expected_response_code != dr->hr.http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- dr->hr.http_status);
+ dr->hr.http_status,
+ ds->expected_response_code);
return;
}
if (MHD_HTTP_OK == dr->hr.http_status)
diff --git a/src/testing/testing_api_cmd_purse_delete.c b/src/testing/testing_api_cmd_purse_delete.c
index f6b7d573..26037359 100644
--- a/src/testing/testing_api_cmd_purse_delete.c
+++ b/src/testing/testing_api_cmd_purse_delete.c
@@ -75,7 +75,8 @@ purse_delete_cb (void *cls,
if (pds->expected_response_code != pdr->hr.http_status)
{
TALER_TESTING_unexpected_status (pds->is,
- pdr->hr.http_status);
+ pdr->hr.http_status,
+ pds->expected_response_code);
return;
}
TALER_TESTING_interpreter_next (pds->is);
diff --git a/src/testing/testing_api_cmd_purse_deposit.c b/src/testing/testing_api_cmd_purse_deposit.c
index eafe3342..8533e25c 100644
--- a/src/testing/testing_api_cmd_purse_deposit.c
+++ b/src/testing/testing_api_cmd_purse_deposit.c
@@ -138,7 +138,8 @@ deposit_cb (void *cls,
if (ds->expected_response_code != dr->hr.http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- dr->hr.http_status);
+ dr->hr.http_status,
+ ds->expected_response_code);
return;
}
if (MHD_HTTP_OK == dr->hr.http_status)
diff --git a/src/testing/testing_api_cmd_purse_merge.c b/src/testing/testing_api_cmd_purse_merge.c
index 503ef162..cf9d4f99 100644
--- a/src/testing/testing_api_cmd_purse_merge.c
+++ b/src/testing/testing_api_cmd_purse_merge.c
@@ -178,7 +178,8 @@ merge_cb (void *cls,
if (ds->expected_response_code != dr->hr.http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- dr->hr.http_status);
+ dr->hr.http_status,
+ ds->expected_response_code);
return;
}
TALER_TESTING_interpreter_next (ds->is);
diff --git a/src/testing/testing_api_cmd_recoup.c b/src/testing/testing_api_cmd_recoup.c
index 263a3303..c4e72333 100644
--- a/src/testing/testing_api_cmd_recoup.c
+++ b/src/testing/testing_api_cmd_recoup.c
@@ -90,7 +90,8 @@ recoup_cb (void *cls,
if (ps->expected_response_code != hr->http_status)
{
TALER_TESTING_unexpected_status (is,
- hr->http_status);
+ hr->http_status,
+ ps->expected_response_code);
return;
}
diff --git a/src/testing/testing_api_cmd_recoup_refresh.c b/src/testing/testing_api_cmd_recoup_refresh.c
index 7de5b96d..f2fc3b6c 100644
--- a/src/testing/testing_api_cmd_recoup_refresh.c
+++ b/src/testing/testing_api_cmd_recoup_refresh.c
@@ -89,7 +89,8 @@ recoup_refresh_cb (void *cls,
if (rrs->expected_response_code != hr->http_status)
{
TALER_TESTING_unexpected_status (is,
- hr->http_status);
+ hr->http_status,
+ rrs->expected_response_code);
return;
}
diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c
index 6449c538..3b35a73b 100644
--- a/src/testing/testing_api_cmd_refresh.c
+++ b/src/testing/testing_api_cmd_refresh.c
@@ -75,7 +75,7 @@ struct TALER_TESTING_FreshCoinData
* applicable.
*/
struct TALER_AgeCommitmentProof *age_commitment_proof;
- struct TALER_AgeCommitmentHash *h_age_commitment;
+ struct TALER_AgeCommitmentHash h_age_commitment;
/**
* The blinding key (needed for recoup operations).
@@ -402,7 +402,8 @@ reveal_cb (void *cls,
}
}
TALER_TESTING_unexpected_status (rrs->is,
- hr->http_status);
+ hr->http_status,
+ rrs->expected_response_code);
return;
}
melt_cmd = TALER_TESTING_interpreter_lookup_command (rrs->is,
@@ -439,8 +440,13 @@ reveal_cb (void *cls,
return;
}
fc->coin_priv = coin->coin_priv;
- fc->age_commitment_proof = coin->age_commitment_proof;
- fc->h_age_commitment = coin->h_age_commitment;
+
+ if (NULL != coin->age_commitment_proof)
+ {
+ fc->age_commitment_proof =
+ TALER_age_commitment_proof_duplicate (coin->age_commitment_proof);
+ fc->h_age_commitment = coin->h_age_commitment;
+ }
TALER_denom_sig_deep_copy (&fc->sig,
&coin->sig);
@@ -558,7 +564,11 @@ refresh_reveal_cleanup (void *cls,
}
for (unsigned int j = 0; j < rrs->num_fresh_coins; j++)
+ {
TALER_denom_sig_free (&rrs->fresh_coins[j].sig);
+ TALER_age_commitment_proof_free (rrs->fresh_coins[j].age_commitment_proof);
+ GNUNET_free (rrs->fresh_coins[j].age_commitment_proof);
+ }
GNUNET_free (rrs->fresh_coins);
GNUNET_free (rrs->psa);
@@ -646,7 +656,8 @@ link_cb (void *cls,
}
}
TALER_TESTING_unexpected_status (rls->is,
- hr->http_status);
+ hr->http_status,
+ rls->expected_response_code);
return;
}
reveal_cmd = TALER_TESTING_interpreter_lookup_command (rls->is,
@@ -937,8 +948,10 @@ melt_cb (void *cls,
return;
}
}
- TALER_TESTING_unexpected_status (rms->is,
- hr->http_status);
+ TALER_TESTING_unexpected_status_with_body (rms->is,
+ hr->http_status,
+ rms->expected_response_code,
+ hr->reply);
return;
}
if (MHD_HTTP_OK == hr->http_status)
@@ -1020,12 +1033,12 @@ melt_run (void *cls,
{
struct TALER_Amount melt_amount;
struct TALER_Amount fresh_amount;
- const struct TALER_AgeCommitmentProof *age_commitment_proof;
- const struct TALER_AgeCommitmentHash *h_age_commitment;
+ const struct TALER_AgeCommitmentProof *age_commitment_proof = NULL;
+ const struct TALER_AgeCommitmentHash *h_age_commitment = NULL;
const struct TALER_DenominationSignature *melt_sig;
const struct TALER_EXCHANGE_DenomPublicKey *melt_denom_pub;
const struct TALER_TESTING_Command *coin_command;
- bool age_restricted;
+ bool age_restricted_denom;
if (NULL == (coin_command
= TALER_TESTING_interpreter_lookup_command (
@@ -1090,7 +1103,10 @@ melt_run (void *cls,
/* Melt amount starts with the melt fee of the old coin; we'll add the
values and withdraw fees of the fresh coins next */
melt_amount = melt_denom_pub->fees.refresh;
- age_restricted = melt_denom_pub->key.age_mask.bits != 0;
+ age_restricted_denom = melt_denom_pub->key.age_mask.bits != 0;
+ GNUNET_assert (age_restricted_denom == (NULL != age_commitment_proof));
+ GNUNET_assert ((NULL == age_commitment_proof) ||
+ (0 < age_commitment_proof->commitment.num));
for (unsigned int i = 0; i<num_fresh_coins; i++)
{
const struct TALER_EXCHANGE_DenomPublicKey *fresh_pk;
@@ -1109,7 +1125,7 @@ melt_run (void *cls,
}
fresh_pk = TALER_TESTING_find_pk (TALER_TESTING_get_keys (rms->is),
&fresh_amount,
- age_restricted);
+ age_restricted_denom);
if (NULL == fresh_pk)
{
GNUNET_break (0);
@@ -1135,13 +1151,20 @@ melt_run (void *cls,
rms->refresh_data.melt_amount = melt_amount;
rms->refresh_data.melt_sig = *melt_sig;
rms->refresh_data.melt_pk = *melt_denom_pub;
- rms->refresh_data.melt_age_commitment_proof = age_commitment_proof;
- rms->refresh_data.melt_h_age_commitment = h_age_commitment;
+
+ if (NULL != age_commitment_proof)
+ {
+ GNUNET_assert (NULL != h_age_commitment);
+ rms->refresh_data.melt_age_commitment_proof = age_commitment_proof;
+ rms->refresh_data.melt_h_age_commitment = h_age_commitment;
+ }
rms->refresh_data.fresh_pks = rms->fresh_pks;
rms->refresh_data.fresh_pks_len = num_fresh_coins;
- GNUNET_assert (age_restricted ==
+ GNUNET_assert (age_restricted_denom ==
(NULL != age_commitment_proof));
+ GNUNET_assert ((NULL == age_commitment_proof) ||
+ (0 < age_commitment_proof->commitment.num));
rms->rmh = TALER_EXCHANGE_melt (
TALER_TESTING_interpreter_get_context (is),
@@ -1194,6 +1217,7 @@ melt_cleanup (void *cls,
TALER_denom_pub_free (&rms->fresh_pks[i].key);
GNUNET_free (rms->fresh_pks);
}
+
GNUNET_free (rms->mbds);
GNUNET_free (rms->melt_fresh_amounts);
GNUNET_free (rms);
@@ -1405,7 +1429,7 @@ refresh_reveal_traits (void *cls,
rrs->fresh_coins[index].age_commitment_proof),
TALER_TESTING_make_trait_h_age_commitment (
index,
- rrs->fresh_coins[index].h_age_commitment),
+ &rrs->fresh_coins[index].h_age_commitment),
TALER_TESTING_make_trait_denom_pub (
index,
rrs->fresh_coins[index].pk),
@@ -1423,6 +1447,7 @@ refresh_reveal_traits (void *cls,
&rrs->psa[index]),
TALER_TESTING_trait_end ()
};
+
return TALER_TESTING_get_trait (traits,
ret,
trait,
diff --git a/src/testing/testing_api_cmd_refund.c b/src/testing/testing_api_cmd_refund.c
index b8ce85f9..5a218bcf 100644
--- a/src/testing/testing_api_cmd_refund.c
+++ b/src/testing/testing_api_cmd_refund.c
@@ -83,7 +83,8 @@ refund_cb (void *cls,
if (rs->expected_response_code != hr->http_status)
{
TALER_TESTING_unexpected_status (rs->is,
- hr->http_status);
+ hr->http_status,
+ rs->expected_response_code);
return;
}
TALER_TESTING_interpreter_next (rs->is);
diff --git a/src/testing/testing_api_cmd_reserve_purse.c b/src/testing/testing_api_cmd_reserve_purse.c
index 511e2d49..ef6964f2 100644
--- a/src/testing/testing_api_cmd_reserve_purse.c
+++ b/src/testing/testing_api_cmd_reserve_purse.c
@@ -154,7 +154,8 @@ purse_cb (void *cls,
if (ds->expected_response_code != dr->hr.http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- dr->hr.http_status);
+ dr->hr.http_status,
+ ds->expected_response_code);
return;
}
switch (dr->hr.http_status)
diff --git a/src/testing/testing_api_cmd_revoke_denom_key.c b/src/testing/testing_api_cmd_revoke_denom_key.c
index 8bbfda63..2663c538 100644
--- a/src/testing/testing_api_cmd_revoke_denom_key.c
+++ b/src/testing/testing_api_cmd_revoke_denom_key.c
@@ -79,7 +79,8 @@ success_cb (
if (rs->expected_response_code != hr->http_status)
{
TALER_TESTING_unexpected_status (rs->is,
- hr->http_status);
+ hr->http_status,
+ rs->expected_response_code);
return;
}
TALER_TESTING_interpreter_next (rs->is);
diff --git a/src/testing/testing_api_cmd_revoke_sign_key.c b/src/testing/testing_api_cmd_revoke_sign_key.c
index 477ffbe8..65b80b4c 100644
--- a/src/testing/testing_api_cmd_revoke_sign_key.c
+++ b/src/testing/testing_api_cmd_revoke_sign_key.c
@@ -79,7 +79,8 @@ success_cb (
if (rs->expected_response_code != hr->http_status)
{
TALER_TESTING_unexpected_status (rs->is,
- hr->http_status);
+ hr->http_status,
+ rs->expected_response_code);
return;
}
TALER_TESTING_interpreter_next (rs->is);
diff --git a/src/testing/testing_api_cmd_run_fakebank.c b/src/testing/testing_api_cmd_run_fakebank.c
index 03b36763..7739d3c0 100644
--- a/src/testing/testing_api_cmd_run_fakebank.c
+++ b/src/testing/testing_api_cmd_run_fakebank.c
@@ -195,6 +195,7 @@ TALER_TESTING_cmd_run_fakebank (
(unsigned int) fakebank_port,
exchange_xtalerbank_account);
GNUNET_free (exchange_xtalerbank_account);
+ GNUNET_free (exchange_payto_uri);
}
GNUNET_free (exchange_payto_uri);
rfs->ba.method = TALER_BANK_AUTH_NONE;
diff --git a/src/testing/testing_api_cmd_set_officer.c b/src/testing/testing_api_cmd_set_officer.c
index f2464c8a..4fbe5e36 100644
--- a/src/testing/testing_api_cmd_set_officer.c
+++ b/src/testing/testing_api_cmd_set_officer.c
@@ -98,7 +98,8 @@ set_officer_cb (void *cls,
if (MHD_HTTP_NO_CONTENT != hr->http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- hr->http_status);
+ hr->http_status,
+ MHD_HTTP_NO_CONTENT);
return;
}
TALER_TESTING_interpreter_next (ds->is);
diff --git a/src/testing/testing_api_cmd_set_wire_fee.c b/src/testing/testing_api_cmd_set_wire_fee.c
index b2002e0f..460a71e4 100644
--- a/src/testing/testing_api_cmd_set_wire_fee.c
+++ b/src/testing/testing_api_cmd_set_wire_fee.c
@@ -90,7 +90,8 @@ wire_add_cb (void *cls,
if (ds->expected_response_code != hr->http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- hr->http_status);
+ hr->http_status,
+ ds->expected_response_code);
return;
}
TALER_TESTING_interpreter_next (ds->is);
diff --git a/src/testing/testing_api_cmd_take_aml_decision.c b/src/testing/testing_api_cmd_take_aml_decision.c
index eb758397..c0e23de2 100644
--- a/src/testing/testing_api_cmd_take_aml_decision.c
+++ b/src/testing/testing_api_cmd_take_aml_decision.c
@@ -108,7 +108,8 @@ take_aml_decision_cb (
if (ds->expected_response != hr->http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- hr->http_status);
+ hr->http_status,
+ ds->expected_response);
return;
}
TALER_TESTING_interpreter_next (ds->is);
diff --git a/src/testing/testing_api_cmd_transfer_get.c b/src/testing/testing_api_cmd_transfer_get.c
index da3585d6..405c8b7f 100644
--- a/src/testing/testing_api_cmd_transfer_get.c
+++ b/src/testing/testing_api_cmd_transfer_get.c
@@ -133,7 +133,8 @@ track_transfer_cb (void *cls,
if (tts->expected_response_code != hr->http_status)
{
TALER_TESTING_unexpected_status (is,
- hr->http_status);
+ hr->http_status,
+ tts->expected_response_code);
return;
}
diff --git a/src/testing/testing_api_cmd_wire_add.c b/src/testing/testing_api_cmd_wire_add.c
index b19cca1e..09d4579c 100644
--- a/src/testing/testing_api_cmd_wire_add.c
+++ b/src/testing/testing_api_cmd_wire_add.c
@@ -80,7 +80,8 @@ wire_add_cb (void *cls,
if (ds->expected_response_code != hr->http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- hr->http_status);
+ hr->http_status,
+ ds->expected_response_code);
return;
}
TALER_TESTING_interpreter_next (ds->is);
diff --git a/src/testing/testing_api_cmd_wire_del.c b/src/testing/testing_api_cmd_wire_del.c
index 61405e6e..50ebfc7c 100644
--- a/src/testing/testing_api_cmd_wire_del.c
+++ b/src/testing/testing_api_cmd_wire_del.c
@@ -80,7 +80,9 @@ wire_del_cb (void *cls,
if (ds->expected_response_code != hr->http_status)
{
TALER_TESTING_unexpected_status (ds->is,
- hr->http_status);
+ hr->http_status,
+ ds->expected_response_code);
+
return;
}
TALER_TESTING_interpreter_next (ds->is);
diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c
index 3e735ad0..2550e55a 100644
--- a/src/testing/testing_api_cmd_withdraw.c
+++ b/src/testing/testing_api_cmd_withdraw.c
@@ -144,10 +144,10 @@ struct WithdrawState
/**
* If age > 0, put here the corresponding age commitment with its proof and
- * its hash, respectivelly, NULL otherwise.
+ * its hash, respectivelly.
*/
- struct TALER_AgeCommitmentProof *age_commitment_proof;
- struct TALER_AgeCommitmentHash *h_age_commitment;
+ struct TALER_AgeCommitmentProof age_commitment_proof;
+ struct TALER_AgeCommitmentHash h_age_commitment;
/**
* Reserve history entry that corresponds to this operation.
@@ -284,7 +284,8 @@ reserve_withdraw_cb (void *cls,
}
}
TALER_TESTING_unexpected_status (is,
- wr->hr.http_status);
+ wr->hr.http_status,
+ ws->expected_response_code);
return;
}
switch (wr->hr.http_status)
@@ -437,7 +438,7 @@ withdraw_run (void *cls,
struct TALER_EXCHANGE_WithdrawCoinInput wci = {
.pk = ws->pk,
.ps = &ws->ps,
- .ach = ws->h_age_commitment
+ .ach = 0 < ws->age ? &ws->h_age_commitment : NULL
};
ws->wsh = TALER_EXCHANGE_withdraw (
TALER_TESTING_interpreter_get_context (is),
@@ -488,16 +489,8 @@ withdraw_cleanup (void *cls,
TALER_EXCHANGE_destroy_denomination_key (ws->pk);
ws->pk = NULL;
}
- if (NULL != ws->age_commitment_proof)
- {
- TALER_age_commitment_proof_free (ws->age_commitment_proof);
- ws->age_commitment_proof = NULL;
- }
- if (NULL != ws->h_age_commitment)
- {
- GNUNET_free (ws->h_age_commitment);
- ws->h_age_commitment = NULL;
- }
+ if (ws->age > 0)
+ TALER_age_commitment_proof_free (&ws->age_commitment_proof);
GNUNET_free (ws->exchange_url);
GNUNET_free (ws->reserve_payto_uri);
GNUNET_free (ws);
@@ -544,9 +537,13 @@ withdraw_traits (void *cls,
TALER_TESTING_make_trait_payto_uri (ws->reserve_payto_uri),
TALER_TESTING_make_trait_exchange_url (ws->exchange_url),
TALER_TESTING_make_trait_age_commitment_proof (0,
- ws->age_commitment_proof),
+ 0 < ws->age
+ ? &ws->age_commitment_proof
+ : NULL),
TALER_TESTING_make_trait_h_age_commitment (0,
- ws->h_age_commitment),
+ 0 < ws->age
+ ? &ws->h_age_commitment
+ : NULL),
TALER_TESTING_trait_end ()
};
@@ -572,13 +569,9 @@ TALER_TESTING_cmd_withdraw_amount (const char *label,
ws->age = age;
if (0 < age)
{
- struct TALER_AgeCommitmentProof *acp;
- struct TALER_AgeCommitmentHash *hac;
struct GNUNET_HashCode seed;
struct TALER_AgeMask mask;
- acp = GNUNET_new (struct TALER_AgeCommitmentProof);
- hac = GNUNET_new (struct TALER_AgeCommitmentHash);
mask = TALER_extensions_get_age_restriction_mask ();
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&seed,
@@ -589,7 +582,7 @@ TALER_TESTING_cmd_withdraw_amount (const char *label,
&mask,
age,
&seed,
- acp))
+ &ws->age_commitment_proof))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to generate age commitment for age %d at %s\n",
@@ -597,10 +590,8 @@ TALER_TESTING_cmd_withdraw_amount (const char *label,
label);
GNUNET_assert (0);
}
- TALER_age_commitment_hash (&acp->commitment,
- hac);
- ws->age_commitment_proof = acp;
- ws->h_age_commitment = hac;
+ TALER_age_commitment_hash (&ws->age_commitment_proof.commitment,
+ &ws->h_age_commitment);
}
ws->reserve_reference = reserve_reference;