fix expected status code

This commit is contained in:
Christian Grothoff 2020-04-12 15:35:38 +02:00
parent 15099429c3
commit d28f18f240
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 87 additions and 112 deletions

View File

@ -204,7 +204,7 @@ handle_refresh_reveal_finished (void *cls,
const json_t *j = response; const json_t *j = response;
struct TALER_EXCHANGE_HttpResponse hr = { struct TALER_EXCHANGE_HttpResponse hr = {
.reply = j, .reply = j,
.http_status = response_code .http_status = (unsigned int) response_code
}; };
rrh->job = NULL; rrh->job = NULL;

View File

@ -109,54 +109,43 @@ run (void *cls,
* response from a refresh-reveal operation. * response from a refresh-reveal operation.
*/ */
struct TALER_TESTING_Command refresh_409_conflict[] = { struct TALER_TESTING_Command refresh_409_conflict[] = {
CMD_TRANSFER_TO_EXCHANGE CMD_TRANSFER_TO_EXCHANGE ("refresh-create-reserve",
("refresh-create-reserve", "EUR:5.01"),
"EUR:5.01"),
/** /**
* Make previous command effective. * Make previous command effective.
*/ */
CMD_EXEC_WIREWATCH CMD_EXEC_WIREWATCH ("wirewatch"),
("wirewatch"),
/** /**
* Withdraw EUR:5. * Withdraw EUR:5.
*/ */
TALER_TESTING_cmd_withdraw_amount TALER_TESTING_cmd_withdraw_amount ("refresh-withdraw-coin",
("refresh-withdraw-coin", "refresh-create-reserve",
"refresh-create-reserve", "EUR:5",
"EUR:5", MHD_HTTP_OK),
MHD_HTTP_OK), TALER_TESTING_cmd_deposit ("refresh-deposit-partial",
"refresh-withdraw-coin",
TALER_TESTING_cmd_deposit 0,
("refresh-deposit-partial", bc.user42_payto,
"refresh-withdraw-coin", "{\"items\":[{\"name\":\"ice cream\",\
0,
bc.user42_payto,
"{\"items\":[{\"name\":\"ice cream\",\
\"value\":\"EUR:1\"}]}", \"value\":\"EUR:1\"}]}",
GNUNET_TIME_UNIT_ZERO, GNUNET_TIME_UNIT_ZERO,
"EUR:1", "EUR:1",
MHD_HTTP_OK), MHD_HTTP_OK),
/** /**
* Melt the rest of the coin's value * Melt the rest of the coin's value
* (EUR:4.00 = 3x EUR:1.03 + 7x EUR:0.13) */ * (EUR:4.00 = 3x EUR:1.03 + 7x EUR:0.13) */
TALER_TESTING_cmd_melt TALER_TESTING_cmd_melt ("refresh-melt",
("refresh-melt", "refresh-withdraw-coin",
"refresh-withdraw-coin", MHD_HTTP_OK,
MHD_HTTP_OK, NULL),
NULL),
/* Trigger 409 Conflict. */ /* Trigger 409 Conflict. */
TALER_TESTING_cmd_flip_upload TALER_TESTING_cmd_flip_upload ("flip-upload",
("flip-upload", CONFIG_FILE,
CONFIG_FILE, "transfer_privs.0"),
"transfer_privs.0"), TALER_TESTING_cmd_refresh_reveal ("refresh-(flipped-)reveal",
TALER_TESTING_cmd_refresh_reveal "refresh-melt",
("refresh-(flipped-)reveal", MHD_HTTP_CONFLICT),
"refresh-melt",
MHD_HTTP_CONFLICT),
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
@ -165,85 +154,71 @@ run (void *cls,
* so it may be better to move those into the "main" * so it may be better to move those into the "main"
* lib test suite. * lib test suite.
*/struct TALER_TESTING_Command refund[] = { */struct TALER_TESTING_Command refund[] = {
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-r1",
CMD_TRANSFER_TO_EXCHANGE "EUR:5.01"),
("create-reserve-r1", CMD_EXEC_WIREWATCH ("wirewatch-r1"),
"EUR:5.01"), TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-r1",
CMD_EXEC_WIREWATCH "create-reserve-r1",
("wirewatch-r1"), "EUR:5",
TALER_TESTING_cmd_withdraw_amount MHD_HTTP_OK),
("withdraw-coin-r1", TALER_TESTING_cmd_deposit ("deposit-refund-1",
"create-reserve-r1", "withdraw-coin-r1",
"EUR:5", 0,
MHD_HTTP_OK), bc.user42_payto,
TALER_TESTING_cmd_deposit "{\"items\":[{\"name\":\"ice cream\","
("deposit-refund-1", "\"value\":\"EUR:5\"}]}",
"withdraw-coin-r1", GNUNET_TIME_UNIT_MINUTES,
0, "EUR:5",
bc.user42_payto, MHD_HTTP_OK),
"{\"items\":[{\"name\":\"ice cream\"," TALER_TESTING_cmd_refund ("refund-currency-mismatch",
"\"value\":\"EUR:5\"}]}", MHD_HTTP_BAD_REQUEST,
GNUNET_TIME_UNIT_MINUTES, "USD:5",
"EUR:5", "USD:0.01",
MHD_HTTP_OK), "deposit-refund-1"),
TALER_TESTING_cmd_refund TALER_TESTING_cmd_refund ("refund-fee-above-amount",
("refund-currency-mismatch", MHD_HTTP_BAD_REQUEST,
MHD_HTTP_PRECONDITION_FAILED, "EUR:5",
"USD:5", "EUR:10",
"USD:0.01", "deposit-refund-1"),
"deposit-refund-1"), TALER_TESTING_cmd_flip_upload ("flip-upload",
TALER_TESTING_cmd_refund CONFIG_FILE,
("refund-fee-above-amount", "merchant_sig"),
MHD_HTTP_BAD_REQUEST, TALER_TESTING_cmd_refund ("refund-bad-sig",
"EUR:5", MHD_HTTP_FORBIDDEN,
"EUR:10", "EUR:5",
"deposit-refund-1"), "EUR:0.01",
TALER_TESTING_cmd_flip_upload "deposit-refund-1"),
("flip-upload",
CONFIG_FILE,
"merchant_sig"),
TALER_TESTING_cmd_refund
("refund-bad-sig",
MHD_HTTP_FORBIDDEN,
"EUR:5",
"EUR:0.01",
"deposit-refund-1"),
/* This next deposit CMD is only used to provide a /* This next deposit CMD is only used to provide a
* good merchant signature to the next (failing) refund * good merchant signature to the next (failing) refund
* operations. */ * operations. */
TALER_TESTING_cmd_deposit ("deposit-refund-to-fail",
TALER_TESTING_cmd_deposit "withdraw-coin-r1",
("deposit-refund-to-fail", 0, /* coin index. */
"withdraw-coin-r1", bc.user42_payto,
0, /* coin index. */ /* This parameter will make any comparison about
bc.user42_payto, h_contract_terms fail, when /refund will be handled.
/* This parameter will make any comparison about So in other words, this is h_contract mismatch. */
h_contract_terms fail, when /refund will be handled. "{\"items\":[{\"name\":\"ice skate\","
So in other words, this is h_contract mismatch. */ "\"value\":\"EUR:5\"}]}",
"{\"items\":[{\"name\":\"ice skate\"," GNUNET_TIME_UNIT_MINUTES,
"\"value\":\"EUR:5\"}]}", "EUR:5",
GNUNET_TIME_UNIT_MINUTES, MHD_HTTP_CONFLICT),
"EUR:5", TALER_TESTING_cmd_refund ("refund-deposit-not-found",
MHD_HTTP_CONFLICT), MHD_HTTP_NOT_FOUND,
TALER_TESTING_cmd_refund "EUR:5",
("refund-deposit-not-found", "EUR:0.01",
MHD_HTTP_NOT_FOUND, "deposit-refund-to-fail"),
"EUR:5", TALER_TESTING_cmd_refund ("refund-insufficient-funds",
"EUR:0.01", MHD_HTTP_PRECONDITION_FAILED,
"deposit-refund-to-fail"), "EUR:50",
TALER_TESTING_cmd_refund "EUR:0.01",
("refund-insufficient-funds", "deposit-refund-1"),
MHD_HTTP_PRECONDITION_FAILED, TALER_TESTING_cmd_refund ("refund-fee-too-low",
"EUR:50", MHD_HTTP_BAD_REQUEST,
"EUR:0.01", "EUR:5",
"deposit-refund-1"), "EUR:0.000001",
TALER_TESTING_cmd_refund "deposit-refund-1"),
("refund-fee-too-low",
MHD_HTTP_BAD_REQUEST,
"EUR:5",
"EUR:0.000001",
"deposit-refund-1"),
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };