1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-21 08:25:21 +00:00
seahub/tests/run-test.sh

50 lines
1.2 KiB
Bash
Raw Normal View History

2014-08-18 08:04:23 +00:00
#!/bin/bash
2014-08-19 08:43:47 +00:00
# If you run this script on your local machine, you must set CCNET_CONF_DIR
# and SEAFILE_CONF_DIR like this:
#
# export CCNET_CONF_DIR=/your/path/to/ccnet
# export SEAFILE_CONF_DIR=/your/path/to/seafile-data
#
set -e
set -x
SCRIPT=$(readlink -f "$0")
SEAHUB_TESTSDIR=$(dirname "${SCRIPT}")
SEAHUB_SRCDIR=$(dirname "${SEAHUB_TESTSDIR}")
export PYTHONPATH="/usr/local/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages:${SEAHUB_SRCDIR}/thirdpart:${PYTHONPATH}"
cd "$SEAHUB_SRCDIR"
2014-08-18 08:04:23 +00:00
function init() {
2014-08-19 08:43:47 +00:00
###############################
# create database and a new user
###############################
2014-08-18 08:04:23 +00:00
./manage.py syncdb
python -c "import ccnet; pool = ccnet.ClientPool('${CCNET_CONF_DIR}'); ccnet_threaded_rpc = ccnet.CcnetThreadedRpcClient(pool, req_pool=True); ccnet_threaded_rpc.add_emailuser('test@test.com', 'testtest', 1, 1);"
2014-08-19 08:43:47 +00:00
}
2014-08-18 08:04:23 +00:00
2014-08-19 08:43:47 +00:00
function start_seahub() {
2014-08-18 08:04:23 +00:00
./manage.py runserver &
}
2014-08-19 08:43:47 +00:00
function run_test() {
pushd tests/casper
casperjs test
2014-08-18 08:04:23 +00:00
popd
}
case $1 in
"init")
init
;;
"run")
2014-08-19 08:43:47 +00:00
start_seahub
run_test
2014-08-18 08:04:23 +00:00
;;
*)
2014-08-19 08:43:47 +00:00
echo "unknow command \"$1\""
2014-08-18 08:04:23 +00:00
;;
esac