1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 07:01:12 +00:00
Files
seahub/tests/seahubtests.sh

52 lines
1.2 KiB
Bash
Raw Normal View History

2014-08-18 16:04:23 +08:00
#!/bin/bash
2014-08-19 16:43:47 +08: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 16:04:23 +08:00
function init() {
2014-08-19 16:43:47 +08:00
###############################
# create database and a new user
###############################
2014-08-18 16:04:23 +08: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 16:43:47 +08:00
}
2014-08-18 16:04:23 +08:00
2014-08-19 16:43:47 +08:00
function start_seahub() {
2014-08-18 16:04:23 +08:00
./manage.py runserver &
}
2014-08-19 16:43:47 +08:00
2014-08-19 16:56:40 +08:00
function run_tests() {
2014-08-19 16:43:47 +08:00
pushd tests/casper
2014-08-19 16:56:40 +08:00
casperjs test .
2014-08-18 16:04:23 +08:00
popd
}
case $1 in
"init")
init
;;
2014-08-19 17:01:31 +08:00
"runserver")
2014-08-19 16:43:47 +08:00
start_seahub
2014-08-19 17:01:31 +08:00
;;
"test")
2014-08-19 16:56:40 +08:00
run_tests
2014-08-18 16:04:23 +08:00
;;
*)
2014-08-19 16:43:47 +08:00
echo "unknow command \"$1\""
2014-08-18 16:04:23 +08:00
;;
esac