Previously `error` field is not populated properly due to double
formatting error message into JSON string. This patch fixes the issue
by avoid second time formatting in `printf` command.
Add new negative tests to functional tests. For that purpose, two functions are
introduced. assert_success makes sure that the passed command returns 0 exit code
and raise an error otherwise. assert_failure makes sure that the passed
command fails and raises an error otherwise.