[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-exchange] branch master updated: test more of /wire,
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-exchange] branch master updated: test more of /wire, fix off-by-one |
Date: |
Mon, 06 Mar 2017 17:34:35 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new 7ba2ee0 test more of /wire, fix off-by-one
7ba2ee0 is described below
commit 7ba2ee09667056d90ae564409df453a9867359d8
Author: Christian Grothoff <address@hidden>
AuthorDate: Mon Mar 6 17:36:10 2017 +0100
test more of /wire, fix off-by-one
---
src/exchange-lib/exchange_api_wire.c | 2 +-
src/exchange-lib/test_exchange_api.c | 44 +++++++++++++++++++++++++++++++-----
2 files changed, 39 insertions(+), 7 deletions(-)
diff --git a/src/exchange-lib/exchange_api_wire.c
b/src/exchange-lib/exchange_api_wire.c
index ae37741..bdf4dc8 100644
--- a/src/exchange-lib/exchange_api_wire.c
+++ b/src/exchange-lib/exchange_api_wire.c
@@ -444,7 +444,7 @@ TALER_EXCHANGE_wire_get_fees (const struct
TALER_MasterPublicKeyP *master_pub,
return GNUNET_SYSERR;
}
}
- af[num_fees].next = NULL;
+ af[num_fees - 1].next = NULL;
if (NULL != cb)
cb (cb_cls,
wire_method,
diff --git a/src/exchange-lib/test_exchange_api.c
b/src/exchange-lib/test_exchange_api.c
index 056d293..9a57e46 100644
--- a/src/exchange-lib/test_exchange_api.c
+++ b/src/exchange-lib/test_exchange_api.c
@@ -506,6 +506,11 @@ struct Command
*/
const char *format;
+ /**
+ * Expected wire fee.
+ */
+ const char *expected_fee;
+
} wire;
/**
@@ -755,6 +760,8 @@ interpreter_run (void *cls);
static void
next_command (struct InterpreterState *is)
{
+ if (GNUNET_SYSERR == result)
+ return; /* ignore, we already failed! */
is->ip++;
is->task = GNUNET_SCHEDULER_add_now (&interpreter_run,
is);
@@ -1366,10 +1373,33 @@ check_fee_cb (void *cls,
{
struct InterpreterState *is = cls;
struct Command *cmd = &is->commands[is->ip];
+ struct TALER_Amount expected_amount;
- GNUNET_break (0 == strcasecmp (cmd->details.wire.format,
- wire_method));
- /* FIXME: actually check @a fees as well... */
+ GNUNET_break ( (0 == strcasecmp ("test",
+ wire_method)) ||
+ (0 == strcasecmp ("sepa",
+ wire_method)) );
+ if (GNUNET_OK !=
+ TALER_string_to_amount (cmd->details.wire.expected_fee,
+ &expected_amount))
+ {
+ GNUNET_break (0);
+ fail (is);
+ return;
+ }
+ while (NULL != fees)
+ {
+ if (0 != TALER_amount_cmp (&fees->wire_fee,
+ &expected_amount))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Wire fee missmatch to command %s\n",
+ cmd->label);
+ fail (is);
+ return;
+ }
+ fees = fees->next;
+ }
}
@@ -2785,14 +2815,16 @@ run (void *cls)
.label = "wire-test",
/* expecting 'test' method in response */
.expected_response_code = MHD_HTTP_OK,
- .details.wire.format = "test" },
+ .details.wire.format = "test",
+ .details.wire.expected_fee = "EUR:0.01" },
#endif
#if WIRE_SEPA
{ .oc = OC_WIRE,
.label = "wire-sepa",
/* expecting 'sepa' method in response */
.expected_response_code = MHD_HTTP_OK,
- .details.wire.format = "sepa" },
+ .details.wire.format = "sepa",
+ .details.wire.expected_fee = "EUR:0.01" },
#endif
/* *************** end of /wire testing ************** */
@@ -3238,7 +3270,7 @@ main (int argc,
}
while (0 != system ("wget -q -t 1 -T 1 http://127.0.0.1:8081/keys -o
/dev/null -O /dev/null"));
fprintf (stderr, "\n");
- result = GNUNET_SYSERR;
+ result = GNUNET_NO;
sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO);
GNUNET_assert (NULL != sigpipe);
shc_chld = GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD,
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-exchange] branch master updated: test more of /wire, fix off-by-one,
gnunet <=