1# -*- mode: shell-script -*-
2
3test_dir=$(cd $(dirname $0) && pwd)
4source "$test_dir/setup.sh"
5
6setUp () {
7    echo
8}
9
10test_set_by_user() {
11    export VIRTUALENVWRAPPER_LOG_FILE="$WORKON_HOME/hooks.log"
12    source "$test_dir/../virtualenvwrapper.sh"
13    assertTrue "Log file was not created" "[ -f $VIRTUALENVWRAPPER_LOG_FILE ]"
14}
15
16test_file_permissions() {
17    export VIRTUALENVWRAPPER_LOG_FILE="$WORKON_HOME/hooks.log"
18    source "$test_dir/../virtualenvwrapper.sh"
19    perms=$(ls -l "$VIRTUALENVWRAPPER_LOG_FILE" | cut -f1 -d' ')
20    #echo $perms
21    assertTrue "Log file permissions are wrong: $perms" "echo $perms | grep '^-rw-rw'"
22}
23
24test_not_set_by_user() {
25    unset WORKON_HOME
26    unset VIRTUALENVWRAPPER_LOG_FILE
27    unset VIRTUALENVWRAPPER_HOOK_DIR
28    source "$test_dir/../virtualenvwrapper.sh"
29    assertSame "" "$VIRTUALENVWRAPPER_LOG_FILE"
30}
31
32. "$test_dir/shunit2"
33