twister

HTTP fault injector for testing
Log | Files | Refs | README | LICENSE

commit c8da17bae95f877b857ea18260a11c6bde4ea393
parent 3bceec019b0bb732b6414c9e11fb60839f49b21b
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Mon, 26 Mar 2018 11:56:30 +0200

modifications can take booleans.

Diffstat:
Msrc/test/test_twister.sh | 16++++++++++++++++
Msrc/twister/taler-twister-service.c | 7+++++++
2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/test/test_twister.sh b/src/test/test_twister.sh @@ -65,6 +65,22 @@ if ! test '{"hello":[],"when":"today"}' = "$emptied_body"; then exit 1 fi +# set boolean field +taler-twister -c ./test_twister.conf \ + --modobject "hello" \ + --value "true" +modobject_body=$(curl -s ${TWISTER_URL}) + +if ! test \ + '{"hello":true,"when":"today"}' = "$modobject_body"; then + printf "Response body (%s) has not been modified as expected\n" \ + "$modobject_body" + kill $web_server_pid + kill $twister_service_pid + exit 1 +fi + + # set field taler-twister -c ./test_twister.conf \ --modobject "hello" \ diff --git a/src/twister/taler-twister-service.c b/src/twister/taler-twister-service.c @@ -977,6 +977,13 @@ modify_object (struct MHD_Connection *con, return; /* At this point, the parent and the target are pointed to. */ + + if (0 == strcmp ("true", modify_value)) + { + TALER_LOG_DEBUG ("New value parsed as boolean true\n"); + new_value = json_true (); + goto perform_modbody; + } if (NULL != (new_value = json_loads (modify_value, JSON_REJECT_DUPLICATES