Skip to content
Snippets Groups Projects
Commit 82f857c7 authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

tests cosmetic

parent f9c10aea
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@ GATEWAY_IP=$(docker inspect backend-test | grep \"Gateway\":\ \" | sed 's/.*Gate
# Test - GET groups
echo "Testing groups API..."
if [ "$(curl -s ${GATEWAY_IP}:65434/services/groups)" != "$GROUPS_REF" ]; then
echo "Tests failed - failed to load groups"
exit 1
......@@ -36,6 +37,7 @@ fi
# Test - GET variables
echo "Testing variables API..."
if [ "$(curl -s ${GATEWAY_IP}:65434/services/variables)" != "$VARIABLES_REF" ]; then
echo "Tests failed - failed to load variables"
exit 1
......@@ -52,6 +54,7 @@ fi
# Test - GET stats
echo "Testing stats API..."
if [ "$(curl -s ${GATEWAY_IP}:65434/services/stats)" != "$STATS_REF" ]; then
echo "Tests failed - failed to load stats"
exit 1
......@@ -60,6 +63,7 @@ fi
# Test - POST requests
echo "Testing requests API..."
response=$(curl -s -H "Content-Type: application/json" -X POST -d ${REQUEST_BODY} ${GATEWAY_IP}:65434/services/queries/requests)
if [ "${response:52}" != "${REQUEST_REF:52}" ]; then
echo "Tests failed - failed to post requests"
......@@ -69,9 +73,10 @@ fi
# Test - POST and GET an article
curl -s -H "Content-Type: application/json" -X POST -d ${ARTICLE_BODY} ${GATEWAY_IP}:65434/services/articles
echo "Testing articles API..."
temp=$(curl -s -H "Content-Type: application/json" -X POST -d ${ARTICLE_BODY} ${GATEWAY_IP}:65434/services/articles)
response=$(curl -s ${GATEWAY_IP}:65434/services/articles | sed "s/\"createdAt\":[0-9]*,//g")
response_ref=$(echo ${ARTICLE_REF} | sed "s/\"createdAt\":[0-9]*,//g")
response_ref=$(echo "${ARTICLE_REF}" | sed "s/\"createdAt\":[0-9]*,//g")
if [ "${response}" != "${response_ref}" ]; then
echo "Tests failed - failed to save/load article"
exit 1
......@@ -80,7 +85,8 @@ fi
# Test - POST and GET a model
curl -s -H "Content-Type: application/json" -X POST -d ${MODEL_BODY} ${GATEWAY_IP}:65434/services/models
echo "Testing models API..."
temp=$(curl -s -H "Content-Type: application/json" -X POST -d ${MODEL_BODY} ${GATEWAY_IP}:65434/services/models)
response=$(curl -s ${GATEWAY_IP}:65434/services/models | sed "s/\"createdAt\":[0-9]*,//g" | sed "s/\"date\":[0-9]*,//g")
response_ref=$(echo "${MODEL_REF}" | sed "s/\"createdAt\":[0-9]*,//g" | sed "s/\"date\":[0-9]*,//g")
if [ "${response}" != "${response_ref}" ]; then
......@@ -89,6 +95,6 @@ if [ "${response}" != "${response_ref}" ]; then
fi
echo "Tests successfully passed"
echo "All tests successfully passed"
exit 0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment