some fixtures for testing

master
Kenneth Barbour 2022-02-09 19:15:26 -05:00
parent 1c79904d73
commit 2c5c019776
7 changed files with 59 additions and 0 deletions

1
test/.gitignore vendored 100644
View File

@ -0,0 +1 @@
tmp/

2
test/README.md 100644
View File

@ -0,0 +1,2 @@
# WXRX Tests
These are tests for the functionality of WXRX

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -0,0 +1,3 @@
noaa_15-1643805264.wav
noaa_15-1643805264-MCIR.png
noaa_15-1643805264-therm.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 KiB

Binary file not shown.

View File

@ -0,0 +1,53 @@
#!/usr/bin/env sh
## Runs automated tests
##
## Usage: __PROG__ [options]
##
prog="$0"
me=`basename "$prog"`
tmp_dir='./tmp'
mkdir -p ${tmp_dir}
# Lines starting with '##' are intended for usage documentation
function usage() {
grep '^##' "$prog" | sed -e 's/^##\s\?//' -e "s/__PROG__/$me/" 1>&2
}
# Like printf, but prints to stderr with prettier formatting if TTY
function logerr() {
if [ -t 2 ]; then
printf "$(tput setaf 1)ERROR$(tput sgr0) ${1}\n" ${@:2} 1>&2
else
printf "${1}\n" ${@:2} 1>&2
fi
}
testEquality() {
assertEquals 1 1
}
testGenerateWebsite() {
data_dir=${tmp_dir}/testGenerateWebsite/data
web_pubdir=${tmp_dir}/testGenerateWebsite/public
bin_path=$(realpath ../generate_website.sh)
# setup a clean directory containing decoded pass data
rm -Rf ${data_dir}
rm -Rf ${web_pubdir}
mkdir -p ${data_dir}
mkdir -p ${web_pubdir}
cp -p ./fixtures/test_generate_website/* ${data_dir}
pushd ${data_dir}
WXRX_WEB_PUBDIR=${web_pubdir} ${bin_path} *-manifest.txt
# index file exists
indexFile=${web_pubdir}/index.html
assertTrue "${indexFile} not created" "[ -f ${indexFile} ]"
popd
}
. shunit2