Small testing script for the API with individual payloads
This commit is contained in:
parent
ec484df578
commit
1264ed75eb
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
function list {
|
||||
echo "Available test payloads:"
|
||||
for file in ./tests/*; do
|
||||
echo $(basename ${file} .json)
|
||||
done
|
||||
}
|
||||
|
||||
[[ $# != 1 ]] && list && exit 0
|
||||
|
||||
file="./tests/${1}"
|
||||
if [ ! -f ${file} ]; then
|
||||
if [ -f ${file}.json ]; then
|
||||
file="${file}.json"
|
||||
else
|
||||
echo "File not found: ${file}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
curl -f -H "REMOTE_USER: apitest" -H "Content-Type: application/json" -d @${file} http://localhost:3030/api
|
||||
|
||||
[[ $? != 0 ]] && echo "HTTP ERROR" && exit 1
|
||||
|
||||
echo ""
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"command": "bogus",
|
||||
"method": "GET"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"command": "version",
|
||||
"method": "READ"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"command": "stats",
|
||||
"method": "GET"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"command": "version",
|
||||
"method": "GET"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"command": "zone",
|
||||
"method": "GET"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"command": "zone",
|
||||
"method": "GET",
|
||||
"args": ["foobar.netlib.re"]
|
||||
}
|
Loading…
Reference in New Issue