test_simple.sh 723 B

12345678910111213141516171819
  1. #!/bin/sh
  2. echo "Running simple test script..."
  3. echo "Testing parameters..."
  4. [ -z "$name" ] && echo "Name variable undefined" && exit 1
  5. [ -z "$user_agent" ] && echo "User-Agent variable undefined" && exit 1
  6. [ "$user_agent" != "test" ] && echo "Invalid User-Agent variable: $user_agent" && exit 1
  7. [ -z "$hook_id" ] && echo "Hook ID variable undefined" && exit 1
  8. [ "$hook_name" != "test_simple" ] && echo "Invalid hook name variable: $hook_name" && exit 1
  9. [ "$hook_method" != "GET" ] && echo "Invalid hook method variable: $hook_method" && exit 1
  10. echo "Testing payload..."
  11. [ -z "$1" ] && echo "Payload undefined" && exit 1
  12. [ "$1" != "{\"foo\": \"bar\"}" ] && echo "Invalid payload: $1" && exit 1
  13. echo "notify: OK"
  14. exit 0