diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2023-07-24 20:23:42 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2023-07-24 20:29:38 +0200 |
commit | 3e29bdfb8bfda133b7c25a36160a3533e836e0b8 (patch) | |
tree | 5d2271678e7b0e3175c340c8a033e3950050a11f /src/testing | |
parent | e9f7ad3742bc16e1f0afa2162564c6faa4f3036f (diff) | |
download | exchange-3e29bdfb8bfda133b7c25a36160a3533e836e0b8.tar.gz exchange-3e29bdfb8bfda133b7c25a36160a3533e836e0b8.tar.bz2 exchange-3e29bdfb8bfda133b7c25a36160a3533e836e0b8.zip |
[age-withdraw] first tests pass
age-withdraw successfully tested (no reveal yet):
1. reserve filled with amount large enough to trigger kyc
2. kyc oauth2 test daemon sets birthday to 2015-00-00
3. usual withdraw fails with CONFLICT and AGE_RESTRICTION_REQUIRED
4. age-withdraw with loo large of an maximum age fails
5. age-withdraw with appropriate maximum age succeeds
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_exchange_api_age_restriction.c | 12 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_age_withdraw.c | 23 |
2 files changed, 21 insertions, 14 deletions
diff --git a/src/testing/test_exchange_api_age_restriction.c b/src/testing/test_exchange_api_age_restriction.c index 93bd28bf9..b3f7357f7 100644 --- a/src/testing/test_exchange_api_age_restriction.c +++ b/src/testing/test_exchange_api_age_restriction.c @@ -284,6 +284,18 @@ run (void *cls, "EUR:10", 0, /* age restriction off */ MHD_HTTP_CONFLICT), + TALER_TESTING_cmd_age_withdraw ("age-withdraw-coin-1-too-low", + "create-reserve-kyc-1", + 18, /* Too high */ + MHD_HTTP_CONFLICT, + "EUR:10", + NULL), + TALER_TESTING_cmd_age_withdraw ("age-withdraw-coin-1", + "create-reserve-kyc-1", + 8, + MHD_HTTP_OK, + "EUR:10", + NULL), TALER_TESTING_cmd_end (), }; diff --git a/src/testing/testing_api_cmd_age_withdraw.c b/src/testing/testing_api_cmd_age_withdraw.c index ea3249c09..9b7bfd209 100644 --- a/src/testing/testing_api_cmd_age_withdraw.c +++ b/src/testing/testing_api_cmd_age_withdraw.c @@ -209,21 +209,15 @@ age_withdraw_cb ( break; case MHD_HTTP_CONFLICT: /* TODO[oec]: Add this to the response-type and handle it here */ - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Age withdraw test command does not YET support status code %u\n", - response->hr.http_status); break; case MHD_HTTP_UNAVAILABLE_FOR_LEGAL_REASONS: - /* TODO[oec]: Add this to response-type and handle it here */ - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Age withdraw test command does not YET support status code %u\n", - response->hr.http_status); - break; default: /* Unsupported status code (by test harness) */ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Age withdraw test command does not support status code %u\n", - response->hr.http_status); + "test command for age-withdraw not support status code %u, body:\n" + ">>%s<<\n", + response->hr.http_status, + json_dumps (response->hr.reply, JSON_INDENT (2))); GNUNET_break (0); break; } @@ -366,12 +360,13 @@ age_withdraw_cleanup ( struct TALER_EXCHANGE_AgeWithdrawCoinInput *in = &aws->coin_inputs[n]; struct CoinOutputState *out = &aws->coin_outputs[n]; - if (NULL != in->denom_pub) + if (NULL != in && NULL != in->denom_pub) { TALER_EXCHANGE_destroy_denomination_key (in->denom_pub); in->denom_pub = NULL; } - TALER_age_commitment_proof_free (&out->details.age_commitment_proof); + if (NULL != out) + TALER_age_commitment_proof_free (&out->details.age_commitment_proof); } GNUNET_free (aws->coin_inputs); GNUNET_free (aws->coin_outputs); @@ -490,10 +485,10 @@ TALER_TESTING_cmd_age_withdraw (const char *label, label); GNUNET_assert (0); } + /* move on to next vararg! */ + amount = va_arg (ap, const char *); } - /* move on to next vararg! */ - amount = va_arg (ap, const char *); GNUNET_assert (NULL == amount); va_end (ap); |