#8 return a 403 if credentials are invalid + adjust corresponding test

This commit is contained in:
2022-10-03 15:09:44 +00:00
parent 73059c724f
commit 384e868501
6 changed files with 94 additions and 29 deletions
+3 -3
View File
@@ -11,15 +11,15 @@ URL="https://dev.thegux.fr"
for i in {0..10}
do
http_response=$(curl -s -o response.txt -w "%{http_code}" ${URL}/get/ -d '{"username":"toto", "password":"tutu"}')
if [ $http_response != "200" ]
if [ $http_response != "403" ]
then
echo "bad http status code : ${http_response}, expect 200"
exit 1
fi
if [ "$(cat response.txt | jq -r '.token')" != "header.payload.signature" ]
if [ "$(cat response.txt | jq -r '.error')" != "invalid credentials" ]
then
echo "bad data returned, expect : ok"
echo "bad data returned, expect : invalid credentials"
exit 1
fi
done