aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-12-09 21:19:33 +0100
committerChristian Grothoff <christian@grothoff.org>2017-12-09 21:19:33 +0100
commit16e2cd8d447244996154f70c8f18f7ea5bf964ff (patch)
tree2892f41e0bafafdfd5a107c23be549198449a099
parent1c3863f5fd03efd0d86ec6831297b508742bb862 (diff)
switch auth based on account number in test
-rw-r--r--src/bank-lib/test_bank_api.c4
-rw-r--r--src/bank-lib/test_bank_interpreter.c36
2 files changed, 38 insertions, 2 deletions
diff --git a/src/bank-lib/test_bank_api.c b/src/bank-lib/test_bank_api.c
index b6160ef39..c70ae8803 100644
--- a/src/bank-lib/test_bank_api.c
+++ b/src/bank-lib/test_bank_api.c
@@ -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,
diff --git a/src/bank-lib/test_bank_interpreter.c b/src/bank-lib/test_bank_interpreter.c
index 8f7abf057..0dfc4c401 100644
--- a/src/bank-lib/test_bank_interpreter.c
+++ b/src/bank-lib/test_bank_interpreter.c
@@ -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",