1.1 --- a/tests/common.sh Wed Mar 09 21:38:56 2016 +0100
1.2 +++ b/tests/common.sh Thu Mar 10 01:43:31 2016 +0100
1.3 @@ -3,25 +3,37 @@
1.4 THIS_DIR=`dirname "$0"`
1.5 BASE_DIR="$THIS_DIR/.."
1.6
1.7 -STORE=/tmp/store
1.8 +STORETYPE=file
1.9 +
1.10 +if [ "$STORETYPE" = "file" ]; then
1.11 + STORE=/tmp/store
1.12 + JOURNAL=/tmp/journal
1.13 +elif [ "$STORETYPE" = "postgresql" ]; then
1.14 + DBNAME='test'
1.15 + STORE="dbname=$DBNAME"
1.16 + JOURNAL="$STORE"
1.17 +fi
1.18 +
1.19 STATIC=/tmp/static
1.20 PREFS=/tmp/prefs
1.21 -JOURNAL=/tmp/journal
1.22
1.23 -ARGS="-S $STORE -P $STATIC -p $PREFS -j $JOURNAL -d"
1.24 +ARGS="-T $STORETYPE -S $STORE -P $STATIC -p $PREFS -j $JOURNAL -d"
1.25
1.26 ACCEPT_SCRIPT="$THIS_DIR/test_handle.py"
1.27 -ACCEPT_ARGS="accept $STORE $JOURNAL $PREFS"
1.28 +ACCEPT_ARGS="accept $STORETYPE $STORE $JOURNAL $PREFS"
1.29
1.30 COUNTER_SCRIPT="$THIS_DIR/test_handle.py"
1.31 -COUNTER_ARGS="counter $STORE $JOURNAL $PREFS"
1.32 +COUNTER_ARGS="counter $STORETYPE $STORE $JOURNAL $PREFS"
1.33
1.34 DECLINE_SCRIPT="$THIS_DIR/test_handle.py"
1.35 -DECLINE_ARGS="decline $STORE $JOURNAL $PREFS"
1.36 +DECLINE_ARGS="decline $STORETYPE $STORE $JOURNAL $PREFS"
1.37
1.38 FREEBUSY_SCRIPT="$BASE_DIR/tools/make_freebusy.py"
1.39 FREEBUSY_ARGS="-s -n"
1.40
1.41 +LIST_SCRIPT="$THIS_DIR/list_table.py"
1.42 +LIST_ARGS="$STORETYPE $STORE $JOURNAL"
1.43 +
1.44 OUTGOING_SCRIPT="$BASE_DIR/imip_person_outgoing.py"
1.45
1.46 PERSON_SCRIPT="$BASE_DIR/imip_person.py"
1.47 @@ -39,9 +51,16 @@
1.48 PYTHONPATH="$BASE_DIR"
1.49 export PYTHONPATH
1.50
1.51 -rm -rf "$STORE"
1.52 +if [ "$STORETYPE" = "file" ]; then
1.53 + rm -rf "$STORE"
1.54 + rm -rf "$JOURNAL"
1.55 +elif [ "$STORETYPE" = "postgresql" ]; then
1.56 + dropdb "$DBNAME"
1.57 + createdb "$DBNAME"
1.58 + psql -f "$BASE_DIR/conf/postgresql/schema.sql" "$DBNAME"
1.59 +fi
1.60 +
1.61 rm -rf "$STATIC"
1.62 rm -rf "$PREFS"
1.63 -rm -rf "$JOURNAL"
1.64 rm -f "$ERROR"
1.65 rm -f out*.tmp