whole tests batch now are ordered to add, then update, and finally delete a test line
This commit is contained in:
parent
23870c262c
commit
0a9f8559c1
11 changed files with 48 additions and 108 deletions
2
test/.gitignore
vendored
Normal file
2
test/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
*~
|
||||
cookie.txt
|
||||
10
test/post_line.sh → test/alter_table.sh
Executable file → Normal file
10
test/post_line.sh → test/alter_table.sh
Executable file → Normal file
|
|
@ -1,4 +1,4 @@
|
|||
#/bin/sh
|
||||
#!/bin/sh
|
||||
|
||||
help() {
|
||||
echo "Syntaxe"
|
||||
|
|
@ -24,8 +24,6 @@ fi
|
|||
. ./dep/tablename.sh
|
||||
. ./dep/data.sh
|
||||
|
||||
. ./tools/title.sh
|
||||
echo "Post $data to table $tablename"
|
||||
result=`curl --header "Content-Type: application/json" -b cookie.txt -X POST --data ’$data’ $address/api.php/records/$tablename/ 2>/dev/null`
|
||||
sh tools/show_result.sh $result
|
||||
echo "\n"
|
||||
. ./tools/post_line.sh
|
||||
. ./tools/set_line.sh
|
||||
. ./tools/del_line.sh
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
#/bin/sh
|
||||
|
||||
help() {
|
||||
echo "Syntaxe"
|
||||
echo "‾‾‾‾‾‾‾"
|
||||
echo "sh $0 [ adresse ] [ tablename ] [ id ]\n"
|
||||
}
|
||||
|
||||
if [ "$1" ]
|
||||
then
|
||||
address=$1
|
||||
fi
|
||||
if [ "$2" ]
|
||||
then
|
||||
tablename=$2
|
||||
fi
|
||||
if [ "$3" ]
|
||||
then
|
||||
id=$3
|
||||
fi
|
||||
|
||||
. ./config.sh
|
||||
. ./dep/address.sh
|
||||
. ./dep/tablename.sh
|
||||
. ./dep/id.sh
|
||||
|
||||
. ./tools/title.sh
|
||||
echo "Delete id $3 of table $2"
|
||||
result=`curl --header "Content-Type: application/json" -X "DELETE" -b cookie.txt $address/api.php/records/$tablename/$id 2> /dev/null`
|
||||
sh tools/show_result.sh $result
|
||||
echo "\n"
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
#/bin/sh
|
||||
|
||||
help() {
|
||||
echo "Syntaxe"
|
||||
echo "‾‾‾‾‾‾‾"
|
||||
echo "sh $0 [ adresse ] [ username ] [ password ]\n"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Missing parameters : web adresses is needed\n"
|
||||
help
|
||||
exit
|
||||
fi
|
||||
if [ -z "$2" ]
|
||||
then
|
||||
echo "Missing parameters : username is needed\n"
|
||||
help
|
||||
exit
|
||||
fi
|
||||
if [ -z "$3" ]
|
||||
then
|
||||
echo "Missing parameters : password is needed\n"
|
||||
help
|
||||
exit
|
||||
fi
|
||||
echo "Login as $2 in cookie.txt"
|
||||
echo "$1 $2 $3"
|
||||
curl --header "Content-Type: application/json" --cookie-jar cookie.txt --request POST --data "{\"username\":\"$2\",\"password\":\"$3\"}" $1/api.php/login
|
||||
echo "\n"
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
#/bin/sh
|
||||
|
||||
help() {
|
||||
echo "Syntaxe"
|
||||
echo "‾‾‾‾‾‾‾"
|
||||
echo "sh $0 [ adresse ] [ table ] [ id ] [ data ]\n"
|
||||
}
|
||||
|
||||
if [ "$1" ]
|
||||
then
|
||||
address=$1
|
||||
|
||||
fi
|
||||
if [ "$2" ]
|
||||
then
|
||||
tablename=$2
|
||||
fi
|
||||
|
||||
if [ "$3" ]
|
||||
then
|
||||
id=$3
|
||||
fi
|
||||
if [ "$4" ]
|
||||
then
|
||||
data=$4
|
||||
fi
|
||||
|
||||
. ./config.sh
|
||||
. ./dep/address.sh
|
||||
. ./dep/tablename.sh
|
||||
. ./dep/id.sh
|
||||
. ./dep/data.sh
|
||||
|
||||
. ./tools/title.sh
|
||||
echo "Set data for tablename with id $id"
|
||||
result=`curl --header "Content-Type: application/json" -b cookie.txt -X PUT --data "$data" $address/api.php/records/$tablename/$id 2>/dev/null`
|
||||
sh tools/show_result.sh $result
|
||||
echo "\n"
|
||||
|
|
@ -3,4 +3,4 @@ password=starwars
|
|||
address=192.168.1.152:8080
|
||||
tablename=ticket
|
||||
id=1
|
||||
data=’{"name" : "ondoing test run", "description" : "this ticket has been added by a testscript"}’
|
||||
data="{\"name\" : \"ondoing test run\", \"description\" : \"this ticket has been added by a testscript\"}"
|
||||
|
|
|
|||
7
test/tools/del_line.sh
Executable file
7
test/tools/del_line.sh
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#/bin/sh
|
||||
|
||||
. ./tools/title.sh
|
||||
echo "Delete id $id of table $tablename"
|
||||
result=`curl -X "DELETE" -b cookie.txt $address/api.php/records/$tablename/$id 2> /dev/null`
|
||||
. ./tools/show_result.sh
|
||||
echo "\n"
|
||||
14
test/tools/get_result.sh
Normal file
14
test/tools/get_result.sh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
code=`echo $result | grep code`
|
||||
|
||||
if [ $code ]
|
||||
then
|
||||
echo "\e[1;31mTest : [fail]\e[0m"
|
||||
else
|
||||
echo "\e[1;32mResult [success]\e[0m"
|
||||
return $0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
9
test/tools/post_line.sh
Executable file
9
test/tools/post_line.sh
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
#/bin/sh
|
||||
|
||||
. ./tools/title.sh
|
||||
echo "Post $data to table $tablename"
|
||||
result=`curl --header "Content-Type: application/json" -b cookie.txt -X POST --data "$data" $address/api.php/records/$tablename/ 2>/dev/null`
|
||||
id=$result
|
||||
. ./tools/show_result.sh
|
||||
echo "\n"
|
||||
|
||||
8
test/tools/set_line.sh
Executable file
8
test/tools/set_line.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#/bin/sh
|
||||
|
||||
. ./tools/title.sh
|
||||
echo ’Set data $data for tablename $tablename with id $id’
|
||||
result=`curl --header "Content-Type: application/json" -b cookie.txt -X PUT --data "$data" $address/api.php/records/$tablename/$id 2>/dev/null`
|
||||
. ./tools/show_result.sh
|
||||
echo "\n"
|
||||
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
code=`echo $1 | grep code`
|
||||
|
||||
if [ $code ]
|
||||
then
|
||||
echo "\e[1;31mTest : [fail]\e[0m"
|
||||
else
|
||||
echo "\e[1;32mResult [success]\e[0m"
|
||||
echo "\e[1;32mResult [success]\e[0m"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue