1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/test_resource_invitation_add.sh Sun Sep 13 17:11:12 2015 +0200
1.3 @@ -0,0 +1,129 @@
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 +RESOURCE_SCRIPT="$THIS_DIR/../imip_resource.py"
1.11 +SHOWMAIL="$THIS_DIR/../tools/showmail.py"
1.12 +STORE=/tmp/store
1.13 +STATIC=/tmp/static
1.14 +PREFS=/tmp/prefs
1.15 +ARGS="-S $STORE -P $STATIC -p $PREFS -d"
1.16 +USER="mailto:resource-room-confroom@example.com"
1.17 +SENDER="mailto:paul.boddie@example.com"
1.18 +FBFILE="$STORE/$USER/freebusy"
1.19 +FBSENDERFILE="$STORE/$SENDER/freebusy"
1.20 +FBSENDEROTHERFILE="$STORE/$SENDER/freebusy-other/$USER"
1.21 +TAB=`printf '\t'`
1.22 +
1.23 +OUTGOING_SCRIPT="$THIS_DIR/../imip_person_outgoing.py"
1.24 +
1.25 +ERROR=err.tmp
1.26 +
1.27 +rm -r $STORE
1.28 +rm -r $STATIC
1.29 +rm -r $PREFS
1.30 +rm $ERROR
1.31 +rm out*.tmp
1.32 +
1.33 +mkdir -p "$PREFS/$USER"
1.34 +echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
1.35 +echo 'share' > "$PREFS/$USER/freebusy_sharing"
1.36 +
1.37 +mkdir -p "$PREFS/$SENDER"
1.38 +echo 'Europe/Oslo' > "$PREFS/$SENDER/TZID"
1.39 +echo 'always' > "$PREFS/$SENDER/event_refreshing"
1.40 +
1.41 +# Publish an event, testing registration in the outgoing handler.
1.42 +
1.43 +"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring.txt" 2>> $ERROR
1.44 +
1.45 + grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \
1.46 +&& echo "Success" \
1.47 +|| echo "Failed"
1.48 +
1.49 +# Present the request to the recipient.
1.50 +
1.51 + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring.txt" 2>> $ERROR \
1.52 +| "$SHOWMAIL" \
1.53 +> out1.tmp
1.54 +
1.55 + grep -q 'METHOD:REPLY' out1.tmp \
1.56 +&& echo "Success" \
1.57 +|| echo "Failed"
1.58 +
1.59 + grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
1.60 +&& echo "Success" \
1.61 +|| echo "Failed"
1.62 +
1.63 +# Present the response to the sender.
1.64 +
1.65 + "$PERSON_SCRIPT" $ARGS < out1.tmp 2>> $ERROR \
1.66 +| "$SHOWMAIL" \
1.67 +> out2.tmp
1.68 +
1.69 + grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDEROTHERFILE" \
1.70 +&& echo "Success" \
1.71 +|| echo "Failed"
1.72 +
1.73 +# Attempt to add an occurrence to the event.
1.74 +
1.75 +"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-add-recurring.txt" 2>> $ERROR
1.76 +
1.77 + grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \
1.78 +&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBSENDERFILE" \
1.79 +&& echo "Success" \
1.80 +|| echo "Failed"
1.81 +
1.82 +# Present the request to the recipient.
1.83 +
1.84 + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-add-recurring.txt" 2>> $ERROR \
1.85 +| "$SHOWMAIL" \
1.86 +> out3.tmp
1.87 +
1.88 + grep -q 'METHOD:REFRESH' out3.tmp \
1.89 +&& echo "Success" \
1.90 +|| echo "Failed"
1.91 +
1.92 + grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
1.93 +&& ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBFILE" \
1.94 +&& echo "Success" \
1.95 +|| echo "Failed"
1.96 +
1.97 +# Present the refresh message to the organiser.
1.98 +
1.99 + "$PERSON_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \
1.100 +| "$SHOWMAIL" \
1.101 +> out4.tmp
1.102 +
1.103 + grep -q 'METHOD:REQUEST' out4.tmp \
1.104 +&& echo "Success" \
1.105 +|| echo "Failed"
1.106 +
1.107 +# Present the request to the recipient.
1.108 +
1.109 + "$RESOURCE_SCRIPT" $ARGS < out4.tmp 2>> $ERROR \
1.110 +| tee out5r.tmp \
1.111 +| "$SHOWMAIL" \
1.112 +> out5.tmp
1.113 +
1.114 + grep -q 'METHOD:REPLY' out5.tmp \
1.115 +&& echo "Success" \
1.116 +|| echo "Failed"
1.117 +
1.118 + grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
1.119 +&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBFILE" \
1.120 +&& echo "Success" \
1.121 +|| echo "Failed"
1.122 +
1.123 +# Present the response to the sender.
1.124 +
1.125 + "$PERSON_SCRIPT" $ARGS < out5r.tmp 2>> $ERROR \
1.126 +| "$SHOWMAIL" \
1.127 +> out6.tmp
1.128 +
1.129 + grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDEROTHERFILE" \
1.130 +&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBSENDEROTHERFILE" \
1.131 +&& echo "Success" \
1.132 +|| echo "Failed"