1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 14:42:10 +00:00
Files
seahub/tests/seahubtests.sh

59 lines
1.4 KiB
Bash
Raw Normal View History

2014-08-18 16:04:23 +08:00
#!/bin/bash
2014-08-27 11:08:39 +08:00
: ${PYTHON=python}
# Change these if you run on local machine
export CI_USERNAME="test@test.com"
export CI_PASSWORD="testtest"
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
2014-08-19 17:46:48 +08:00
if [[ ${TRAVIS} != "" ]]; then
set -x
fi
2014-08-19 16:43:47 +08:00
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-27 11:08:39 +08:00
$PYTHON ./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('${CI_USERNAME}', '${CI_PASSWORD}', 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-27 11:08:39 +08:00
$PYTHON ./manage.py runserver 1>/dev/null &
sleep 5
2014-08-18 16:04:23 +08:00
}
2014-08-19 16:43:47 +08:00
2014-08-19 16:56:40 +08:00
function run_tests() {
2014-08-27 11:08:39 +08:00
pushd tests
$PYTHON integration_suite.py
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