fix test_kyc_api: adapt test logic to improved OAuth2.0 kyc API:

This commit is contained in:
Christian Grothoff 2023-01-16 11:25:18 +01:00
parent 6231c365fd
commit d5619de525
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 10 additions and 26 deletions

View File

@ -3600,8 +3600,7 @@ struct TALER_EXCHANGE_KycProofHandle;
* @param h_payto hash of payto URI identifying the target account
* @param logic name of the KYC logic to run
* @param args additional args to pass, can be NULL
* or a string to append to the URL. Must
* then begin with '/' or '?'.
* or a string to append to the URL. Must then begin with '&'.
* @param cb function to call with the result
* @param cb_cls closure for @a cb
* @return NULL on error

View File

@ -2535,7 +2535,6 @@ TALER_TESTING_cmd_check_kyc_get (const char *label,
* @param logic_section name of the KYC provider section
* in the exchange configuration for this proof
* @param code OAuth 2.0 code to use
* @param state OAuth 2.0 state to use
* @param expected_response_code expected HTTP status
* @return the command
*/
@ -2545,7 +2544,6 @@ TALER_TESTING_cmd_proof_kyc_oauth2 (
const char *payment_target_reference,
const char *logic_section,
const char *code,
const char *state,
unsigned int expected_response_code);

View File

@ -154,8 +154,7 @@ TALER_EXCHANGE_kyc_proof (struct TALER_EXCHANGE_Handle *exchange,
if (NULL == args)
args = "";
else
GNUNET_assert ( (args[0] == '?') ||
(args[0] == '/') );
GNUNET_assert (args[0] == '&');
if (GNUNET_YES !=
TEAH_handle_is_ready (exchange))
{
@ -172,9 +171,9 @@ TALER_EXCHANGE_kyc_proof (struct TALER_EXCHANGE_Handle *exchange,
sizeof (hstr));
*end = '\0';
GNUNET_asprintf (&arg_str,
"/kyc-proof/%s/%s%s",
hstr,
"/kyc-proof/%s?state=%s%s",
logic,
hstr,
args);
}
kph = GNUNET_new (struct TALER_EXCHANGE_KycProofHandle);

View File

@ -131,7 +131,6 @@ run (void *cls,
"withdraw-coin-1-lacking-kyc",
"kyc-provider-test-oauth2",
"pass",
"state",
MHD_HTTP_SEE_OTHER),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1-with-kyc",
"create-reserve-1",
@ -175,7 +174,6 @@ run (void *cls,
"track-deposit-kyc-ready",
"kyc-provider-test-oauth2",
"bad",
"state",
MHD_HTTP_BAD_GATEWAY),
TALER_TESTING_cmd_oauth ("start-oauth-service",
6666),
@ -183,13 +181,11 @@ run (void *cls,
"track-deposit-kyc-ready",
"kyc-provider-test-oauth2",
"bad",
"state",
MHD_HTTP_FORBIDDEN),
TALER_TESTING_cmd_proof_kyc_oauth2 ("proof-kyc-fail",
"track-deposit-kyc-ready",
"kyc-provider-test-oauth2",
"pass",
"state",
MHD_HTTP_SEE_OTHER),
CMD_EXEC_AGGREGATOR ("run-aggregator-after-kyc"),
TALER_TESTING_cmd_check_bank_transfer (
@ -216,7 +212,6 @@ run (void *cls,
"wallet-kyc-fail",
"kyc-provider-test-oauth2",
"pass",
"state",
MHD_HTTP_SEE_OTHER),
TALER_TESTING_cmd_check_kyc_get ("wallet-kyc-check",
"wallet-kyc-fail",
@ -311,7 +306,6 @@ run (void *cls,
"purse-merge-into-reserve",
"kyc-provider-test-oauth2",
"pass",
"state",
MHD_HTTP_SEE_OTHER),
TALER_TESTING_cmd_purse_merge (
"purse-merge-into-reserve",
@ -353,7 +347,6 @@ run (void *cls,
"purse-create-with-reserve",
"kyc-provider-test-oauth2",
"pass",
"state",
MHD_HTTP_SEE_OTHER),
TALER_TESTING_cmd_purse_create_with_reserve (
"purse-create-with-reserve",

View File

@ -43,11 +43,6 @@ struct KycProofGetState
*/
const char *code;
/**
* State to pass.
*/
const char *state;
/**
* Logic section name to pass to `/kyc-proof/` handler.
*/
@ -158,10 +153,12 @@ proof_kyc_run (void *cls,
TALER_TESTING_interpreter_fail (kps->is);
return;
}
if (NULL == kps->code)
uargs = NULL;
else
GNUNET_asprintf (&uargs,
"?code=%s&state=%s",
kps->code,
kps->state);
"&code=%s",
kps->code);
kps->kph = TALER_EXCHANGE_kyc_proof (is->exchange,
h_payto,
kps->logic,
@ -235,14 +232,12 @@ TALER_TESTING_cmd_proof_kyc_oauth2 (
const char *payment_target_reference,
const char *logic_section,
const char *code,
const char *state,
unsigned int expected_response_code)
{
struct KycProofGetState *kps;
kps = GNUNET_new (struct KycProofGetState);
kps->code = code;
kps->state = state;
kps->logic = logic_section;
kps->payment_target_reference = payment_target_reference;
kps->expected_response_code = expected_response_code;