summaryrefslogtreecommitdiff
path: root/src/bank-lib/test_bank_interpreter.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-06-11 15:25:59 +0200
committerChristian Grothoff <christian@grothoff.org>2017-06-11 15:25:59 +0200
commit16b7c266057cbfc6d235b6a1c3fe914b14944a25 (patch)
tree8d35fb560e52d54c01b12ca476112027c296fa0f /src/bank-lib/test_bank_interpreter.c
parent1eb739c670ffdb3363f54b1efdcb8343cb1bd272 (diff)
downloadexchange-16b7c266057cbfc6d235b6a1c3fe914b14944a25.tar.gz
exchange-16b7c266057cbfc6d235b6a1c3fe914b14944a25.tar.bz2
exchange-16b7c266057cbfc6d235b6a1c3fe914b14944a25.zip
modify fakebank API to allow arbitrary subjects, not just well-fromed WTIDs
Diffstat (limited to 'src/bank-lib/test_bank_interpreter.c')
-rw-r--r--src/bank-lib/test_bank_interpreter.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/src/bank-lib/test_bank_interpreter.c b/src/bank-lib/test_bank_interpreter.c
index e966424ef..f5aee8ee6 100644
--- a/src/bank-lib/test_bank_interpreter.c
+++ b/src/bank-lib/test_bank_interpreter.c
@@ -572,7 +572,9 @@ history_cb (void *cls,
"Expected history of length %llu, got %llu\n",
(unsigned long long) total,
(unsigned long long) cmd->details.history.results_obtained);
- print_expected (h, total, UINT_MAX);
+ print_expected (h,
+ total,
+ UINT_MAX);
free_history (h,
total);
fail (is);
@@ -621,7 +623,6 @@ interpreter_run (void *cls)
struct InterpreterState *is = cls;
struct TBI_Command *cmd = &is->commands[is->ip];
const struct TBI_Command *ref;
- struct TALER_WireTransferIdentifierRawP wtid;
struct TALER_Amount amount;
const struct GNUNET_SCHEDULER_TaskContext *tc;
struct TALER_BANK_AuthenticationData auth;
@@ -719,25 +720,34 @@ interpreter_run (void *cls)
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (ref->details.admin_add_incoming.amount,
&amount));
- if (GNUNET_OK !=
- TALER_FAKEBANK_check (is->fakebank,
- &amount,
- ref->details.admin_add_incoming.debit_account_no,
- ref->details.admin_add_incoming.credit_account_no,
- ref->details.admin_add_incoming.exchange_base_url,
- &wtid))
{
- GNUNET_break (0);
- fail (is);
- return;
- }
- if (0 != memcmp (&wtid,
- &ref->details.admin_add_incoming.wtid,
- sizeof (wtid)))
- {
- GNUNET_break (0);
- fail (is);
- return;
+ char *subject;
+ char *expect;
+
+ if (GNUNET_OK !=
+ TALER_FAKEBANK_check (is->fakebank,
+ &amount,
+ ref->details.admin_add_incoming.debit_account_no,
+ ref->details.admin_add_incoming.credit_account_no,
+ ref->details.admin_add_incoming.exchange_base_url,
+ &subject))
+ {
+ GNUNET_break (0);
+ fail (is);
+ return;
+ }
+ expect = GNUNET_STRINGS_data_to_string_alloc (&ref->details.admin_add_incoming.wtid,
+ sizeof (ref->details.admin_add_incoming.wtid));
+ if (0 != strcmp (subject, expect))
+ {
+ GNUNET_free (expect);
+ GNUNET_free (subject);
+ GNUNET_break (0);
+ fail (is);
+ return;
+ }
+ GNUNET_free (subject);
+ GNUNET_free (expect);
}
is->ip++;
is->task = GNUNET_SCHEDULER_add_now (&interpreter_run,