Break up test scripts
This commit is contained in:
40
test/test_get.sh
Executable file
40
test/test_get.sh
Executable 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"
|
||||
Reference in New Issue
Block a user