diff options
Diffstat (limited to 'src/testing/testing_api_cmd_checkserver.c')
-rw-r--r-- | src/testing/testing_api_cmd_checkserver.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/src/testing/testing_api_cmd_checkserver.c b/src/testing/testing_api_cmd_checkserver.c index d806f3eb..1414bd1d 100644 --- a/src/testing/testing_api_cmd_checkserver.c +++ b/src/testing/testing_api_cmd_checkserver.c @@ -75,7 +75,7 @@ struct CheckState /** * Expected body of the pending webhook. */ - void *expected_body; + char *expected_body; }; @@ -95,31 +95,48 @@ checkserver_run (void *cls, const struct TALER_TESTING_Command *ref; (void) cmd; cs->is = is; + ref = TALER_TESTING_interpreter_lookup_command (is, cs->ref_operation); + if (NULL == ref) { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "ref NULL\n"); GNUNET_break (0); TALER_TESTING_interpreter_fail (is); return; } char **expected_url; - if (GNUNET_OK != TALER_TESTING_get_trait_urls (ref, cs->index, &expected_url)) { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Trait url does not work\n"); + GNUNET_break (0); TALER_TESTING_interpreter_fail (is); + return; + } + if (NULL == *expected_url) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Trait for url is NULL!?\n"); + GNUNET_break (0); + TALER_TESTING_interpreter_fail (is); + return; } if (0 != strcmp (cs->expected_url, *expected_url)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "URL does not match\n"); + "URL does not match: `%s' != `%s'\n", + cs->expected_url, + *expected_url); TALER_TESTING_interpreter_fail (is); return; } @@ -155,12 +172,14 @@ checkserver_run (void *cls, *expected_header)) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "header does not match\n"); + "header does not match: `%s' != `%s'\n", + cs->expected_header, + *expected_header); TALER_TESTING_interpreter_fail (is); return; } - void **expected_body; + char **expected_body; if (GNUNET_OK != TALER_TESTING_get_trait_http_body (ref, @@ -171,16 +190,20 @@ checkserver_run (void *cls, ( (NULL != cs->expected_body) && (NULL == expected_body)) || ( (NULL != cs->expected_body) && (0 != strcmp (cs->expected_body, - *expected_body)) ) ) + *expected_body) ) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "body does not match\n"); + "body does not match : `%s' and `%s'\n", + cs->expected_body, + *expected_body); TALER_TESTING_interpreter_fail (is); return; } + TALER_TESTING_interpreter_next (is); } + /** * This function is used to check the web server * @@ -199,7 +222,7 @@ TALER_TESTING_cmd_checkserver2 (const char *label, char *expected_url, char *expected_method, char *expected_header, - void *expected_body) + char *expected_body) { struct CheckState *cs; @@ -231,9 +254,9 @@ TALER_TESTING_cmd_checkserver (const char *label, return TALER_TESTING_cmd_checkserver2 (label, ref_operation, index, - "http://localhost:12345/", + "/", "POST", - "Taler-test-header: EFEHYJS-Bakery", + "EFEHYJS-Bakery", "5.0 EUR"); } |