treasuredb/t/schema.sh
Florian "flowdy" Heß bb05b06cf3 Test suite starts covering HTTP interface.
+ Added some files missing in previous commits.
2017-02-06 08:10:05 +01:00

26 lines
656 B
Bash

#!/bin/bash
set -e
db=${1-`mktemp -t trsr-XXXXXXXXX.db`}
setup_database() {
cat schema/{tables.sql,*/*} | sqlite3 $db
}
cleanup () { local rc=$?; rm -i $db; exit $rc; }
trap cleanup EXIT
echo "My database file: $db"
setup_database $db
echo -e "Test level #1: Plain SQL commands\n\t(Create accounts, debits, credits, transfers and revocation)";
diff t/schema.out <(sqlite3 $db < t/schema.sql 2>&1)
echo "Test level #2: Access via DBIx::Class API"
export TRSRDB_SQLITE_FILE=$db
: > $db; setup_database $db && perl t/01_schema.t
echo "Test level #3: Access via perl scripts and HTTP server"
: > $db; setup_database $db && perl t/02_http+scripts.t