switch auth based on account number in test

This commit is contained in:
Christian Grothoff 2017-12-09 21:19:33 +01:00
parent 1c3863f5fd
commit 16e2cd8d44
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 38 additions and 2 deletions

View File

@ -53,7 +53,7 @@ run (void *cls)
.details.admin_add_incoming.subject = "subject 1",
.details.admin_add_incoming.expected_response_code = MHD_HTTP_OK,
.details.admin_add_incoming.credit_account_no = 2,
.details.admin_add_incoming.debit_account_no = 1, /* Ignored */
.details.admin_add_incoming.debit_account_no = 1,
.details.admin_add_incoming.amount = "KUDOS:5.01" },
/* Move money from Bank to Exchange */
{ .oc = TBI_OC_ADMIN_ADD_INCOMING,
@ -62,7 +62,7 @@ run (void *cls)
.details.admin_add_incoming.subject = "subject 2",
.details.admin_add_incoming.expected_response_code = MHD_HTTP_OK,
.details.admin_add_incoming.credit_account_no = 2,
.details.admin_add_incoming.debit_account_no = 1, /* Ignored */
.details.admin_add_incoming.debit_account_no = 1,
.details.admin_add_incoming.amount = "KUDOS:5.01" },
/* Ask Exchange's incoming history */
{ .oc = TBI_OC_HISTORY,

View File

@ -779,6 +779,18 @@ interpreter_run (void *cls)
return;
}
GNUNET_break (NULL != cmd->details.admin_add_incoming.subject);
switch (cmd->details.admin_add_incoming.debit_account_no)
{
case 1:
auth.details.basic.username = "Bank";
break;
case 2:
auth.details.basic.username = "Exchange";
break;
default:
GNUNET_break (0);
break;
}
cmd->details.admin_add_incoming.aih
= TALER_BANK_admin_add_incoming (is->ctx,
"http://localhost:8080",
@ -814,6 +826,18 @@ interpreter_run (void *cls)
rowid = ref->details.admin_add_incoming.row_id;
else
rowid = UINT64_MAX;
switch (cmd->details.history.account_number)
{
case 1:
auth.details.basic.username = "Bank";
break;
case 2:
auth.details.basic.username = "Exchange";
break;
default:
GNUNET_break (0);
break;
}
cmd->details.history.hh
= TALER_BANK_history (is->ctx,
"http://localhost:8080",
@ -879,6 +903,18 @@ interpreter_run (void *cls)
cmd->details.reject.cmd_ref);
GNUNET_assert (NULL != ref);
GNUNET_assert (TBI_OC_ADMIN_ADD_INCOMING == ref->oc);
switch (ref->details.admin_add_incoming.debit_account_no)
{
case 1:
auth.details.basic.username = "Bank";
break;
case 2:
auth.details.basic.username = "Exchange";
break;
default:
GNUNET_break (0);
break;
}
cmd->details.reject.rh
= TALER_BANK_reject (is->ctx,
"http://localhost:8080",