diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2023-07-10 10:22:29 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2023-07-10 10:22:29 +0200 |
commit | 9d706a01a23e36e1c349d06e7a1be8bb44b7f0d5 (patch) | |
tree | 1ac7596f8921d476c5e0e9d7dfc64e28a6b64161 /src/include/taler_testing_lib.h | |
parent | 7e9f5324b719338d790a5eb18c209469d33c708a (diff) |
added expected HTTP-code to logger
Diffstat (limited to 'src/include/taler_testing_lib.h')
-rw-r--r-- | src/include/taler_testing_lib.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 332c3a347..8767ee899 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -57,18 +57,44 @@ * * @param is interpreter to fail * @param status unexpected HTTP status code received + * @param expected expected HTTP status code */ -#define TALER_TESTING_unexpected_status(is,status) \ +#define TALER_TESTING_unexpected_status(is,status, expected) \ do { \ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ - "Unexpected response code %u to command %s in %s:%u\n", \ + "Unexpected response code %u (expected: %u) to command %s in %s:%u\n", \ status, \ + expected, \ TALER_TESTING_interpreter_get_current_label (is), \ __FILE__, \ __LINE__); \ TALER_TESTING_interpreter_fail (is); \ } while (0) +/** + * Log an error message about us receiving an unexpected HTTP + * status code at the current command and fail the test and print the response + * body (expected as json). + * + * @param is interpreter to fail + * @param status unexpected HTTP status code received + * @param expected expected HTTP status code + * @param body received JSON-reply + */ +#define TALER_TESTING_unexpected_status_with_body(is,status, expected, body) \ + do { \ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ + "Unexpected response code %u (expected: %u) to " \ + "command %s in %s:%u\nwith body:\n>>%s<<\n", \ + status, \ + expected, \ + TALER_TESTING_interpreter_get_current_label (is), \ + __FILE__, \ + __LINE__, \ + json_dumps (body, JSON_INDENT (2))); \ + TALER_TESTING_interpreter_fail (is); \ + } while (0) + /** * Log an error message about a command not having |