Add bootstrap and test. Py3.4 by default, move to django_cas_ng and fnpdeploy.
[fnp-django-template.git] / tests / test_bootstrap.sh
1 #!/bin/bash
2 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3 # Colorful output.
4 strong='\e[0;32m'
5 error='\e[1;31m'
6 normal='\e[0m'
7
8 tmpdir="`mktemp -d "$DIR/test-XXX"`"
9 echo "$tmpdir"
10
11
12 export WORKON_HOME="$tmpdir/v"
13 mkdir "$WORKON_HOME"
14
15
16 PYTHON="$1"
17 if [ -z "$PYTHON" ]; then
18   PYTHON=python
19 fi
20 PYTHON_VER="`$PYTHON -V 2>&1`"
21 echo -e "${strong}Using $PYTHON_VER${normal}"
22 PYTHON="`which $PYTHON`"
23
24 FNP_PROJECT_TEMPLATE="$DIR"/..
25 projectdir="$tmpdir"/p
26 mkdir "$projectdir"
27 cd "$projectdir"
28 . "$DIR"/../bootstrap.sh TEST_PROJECT --python "$PYTHON"
29
30
31 # Test for active virtualenv
32 if [ "$VIRTUAL_ENV" != "$WORKON_HOME/TEST_PROJECT" ]; then
33     echo -e "${error}Expected to be in virtualenv, found python: `which python`${normal}"
34 fi
35 if [ "`python -V 2>&1`" != "$PYTHON_VER" ]; then
36     echo -e "${error}Expected $PYTHON_VER, found `python -V 2>&1`${normal}"
37 fi
38
39 # Test that there is only project dir in the dir.
40 if [ "`ls "$projectdir"`" != "TEST_PROJECT" ]; then
41     echo -e "${error}Only created project expected in project dir, found: `ls "$projectdir"`${normal}"
42 fi
43
44 rm -rf "$tmpdir"