1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/test_person_invitation_refresh.sh Sat Sep 05 00:36:31 2015 +0200
1.3 @@ -0,0 +1,100 @@
1.4 +#!/bin/sh
1.5 +
1.6 +THIS_DIR=`dirname $0`
1.7 +
1.8 +TEMPLATES="$THIS_DIR/templates"
1.9 +PERSON_SCRIPT="$THIS_DIR/../imip_person.py"
1.10 +SHOWMAIL="$THIS_DIR/../tools/showmail.py"
1.11 +STORE=/tmp/store
1.12 +STATIC=/tmp/static
1.13 +PREFS=/tmp/prefs
1.14 +ARGS="-S $STORE -P $STATIC -p $PREFS -d"
1.15 +USER="mailto:vincent.vole@example.com"
1.16 +SENDER="mailto:paul.boddie@example.com"
1.17 +FBFILE="$STORE/$USER/freebusy"
1.18 +FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER"
1.19 +FBSENDERFILE="$STORE/$SENDER/freebusy"
1.20 +TAB=`printf '\t'`
1.21 +
1.22 +OUTGOING_SCRIPT="$THIS_DIR/../imip_person_outgoing.py"
1.23 +
1.24 +PYTHONPATH="$THIS_DIR/.."
1.25 +export PYTHONPATH
1.26 +
1.27 +ACCEPT_SCRIPT="$THIS_DIR/test_handle.py"
1.28 +ACCEPT_ARGS="accept $STORE"
1.29 +
1.30 +DECLINE_SCRIPT="$THIS_DIR/test_handle.py"
1.31 +DECLINE_ARGS="decline $STORE"
1.32 +
1.33 +ERROR=err.tmp
1.34 +
1.35 +rm -r $STORE
1.36 +rm -r $STATIC
1.37 +rm -r $PREFS
1.38 +rm $ERROR
1.39 +rm out*.tmp
1.40 +
1.41 +mkdir -p "$PREFS/$USER"
1.42 +echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
1.43 +echo 'share' > "$PREFS/$USER/freebusy_sharing"
1.44 +
1.45 +mkdir -p "$PREFS/$SENDER"
1.46 +echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
1.47 +echo 'always' > "$PREFS/$SENDER/event_refreshing"
1.48 +
1.49 +# Publish an event, testing registration in the outgoing handler.
1.50 +
1.51 +"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR
1.52 +
1.53 + grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \
1.54 +&& echo "Success" \
1.55 +|| echo "Failed"
1.56 +
1.57 +# Test a request from an attendee for the event details to be refreshed.
1.58 +
1.59 + "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \
1.60 +| "$SHOWMAIL" \
1.61 +> out2.tmp
1.62 +
1.63 + grep -q 'METHOD:REQUEST' out2.tmp \
1.64 +&& echo "Success" \
1.65 +|| echo "Failed"
1.66 +
1.67 +# Present the result to the recipient.
1.68 +
1.69 + "$PERSON_SCRIPT" $ARGS < out2.tmp 2>> $ERROR \
1.70 +| "$SHOWMAIL" \
1.71 +> out3.tmp
1.72 +
1.73 + ! grep -q 'METHOD:REPLY' out3.tmp \
1.74 +&& echo "Success" \
1.75 +|| echo "Failed"
1.76 +
1.77 + ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
1.78 +&& echo "Success" \
1.79 +|| echo "Failed"
1.80 +
1.81 + grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \
1.82 +&& echo "Success" \
1.83 +|| echo "Failed"
1.84 +
1.85 +# Test acceptance and registration in the outgoing handler.
1.86 +
1.87 + "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \
1.88 +| tee out4.tmp \
1.89 +| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
1.90 +
1.91 + grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
1.92 +&& echo "Success" \
1.93 +|| echo "Failed"
1.94 +
1.95 +# Test a request from a non-attendee for the event details to be refreshed.
1.96 +
1.97 + "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring-non-attendee.txt" 2>> $ERROR \
1.98 +| "$SHOWMAIL" \
1.99 +> out5.tmp
1.100 +
1.101 + ! grep -q 'METHOD:REQUEST' out5.tmp \
1.102 +&& echo "Success" \
1.103 +|| echo "Failed"