Break up test scripts

This commit is contained in:
2019-06-19 18:53:31 +02:00
parent dd8e62bdab
commit 0004064a27
7 changed files with 114 additions and 89 deletions

40
test/test_get.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/bash
function TestGetContent()
{
downloadedFile="./temp"
if curl "$1" --output "$downloadedFile" 2> /dev/null; then
expectedMd5="$(md5sum $2 | awk '{print $1}')"
actualMd5="$(md5sum $downloadedFile | awk '{print $1}')"
if [ "$expectedMd5" == "$actualMd5" ]; then
echo "SUCCESS for $1"
else
echo "FAILURE MD5 differs for $1"
fi
rm $downloadedFile
else
echo "FAILURE Cannot GET $1"
fi
}
function TestGET()
{
truthFile="$WWW_ROOT/$1"
getUrl="http://localhost:8080/$1"
TestGetContent $getUrl $truthFile
echo ""
}
echo "********"
echo "GET TEST"
echo "********"
TestGET "index.html"
TestGET "robedude.png"
TestGET "hope.jpg"
TestGET "nevada.mp3"
TestGET "index.css"
TestGET "test.js"
TestGET "subdir/index.html"