Make the api-test script ask for which server to test (rest/ws).

This commit is contained in:
Ken Moore
2016-05-18 08:59:56 -04:00
parent 02d6a326e4
commit 826eb104c4

View File

@@ -3,6 +3,7 @@
# Both resty/jsawk use bash'isms
# Possible environment variables
# APITESTREST - [yes/no]
# APITESTUSER - username
# APITESTPASS - password
# APITESTNAMESPACE - namespace / sysadm
@@ -60,6 +61,19 @@ if [ ! -d "${HOME}/.npm/wss" ] ; then
fi
fi
if [ -z "$APITESTREST" ] ; then
echo "Test REST server?"
echo -e "[y/N]>\c"
read APITESTREST
echo ""
fi
if [ -z "$APITESTREST" -o "$APITESTREST" != "y" ] ; then
RESTMODE="no"
else
RESTMODE="yes"
fi
if [ -z "$APITESTUSER" ] ; then
echo "Enter your username:"
echo -e "($DEFUSER)>\c"
@@ -144,7 +158,7 @@ rm $ofile >/dev/null 2>/dev/null
ofile="/tmp/api-response"
echo "" > $ofile
echo "REST Request:" | tee -a $ofile
echo "REST Request (example):" | tee -a $ofile
echo "-------------------------------" | tee -a $ofile
echo "PUT /${APITESTNAMESPACE}/${APITESTCLASS}" | tee -a $ofile
echo "${APITESTPAYLOAD}" | perl -0007 -MJSON -ne'print to_json(from_json($_, {allow_nonref=>1}),{pretty=>1})."\n"' | tee -a $ofile