1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/test_resource_invitation_constraints_multiple.sh Fri Jan 29 22:25:02 2016 +0100
1.3 @@ -0,0 +1,89 @@
1.4 +#!/bin/sh
1.5 +
1.6 +. "`dirname \"$0\"`/common.sh"
1.7 +
1.8 +USER="mailto:resource-room-sauna@example.com"
1.9 +SENDER="mailto:paul.boddie@example.net"
1.10 +FBFILE="$STORE/$USER/freebusy"
1.11 +FBOFFERFILE="$STORE/$USER/freebusy-offers"
1.12 +FBSENDERFILE="$STORE/$SENDER/freebusy"
1.13 +FBSENDEROTHERFILE="$STORE/$SENDER/freebusy-other/$USER"
1.14 +FBSENDERREQUESTS="$STORE/$SENDER/requests"
1.15 +
1.16 +mkdir -p "$PREFS/$USER"
1.17 +echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
1.18 +echo 'share' > "$PREFS/$USER/freebusy_sharing"
1.19 +cat > "$PREFS/$USER/scheduling_function" <<EOF
1.20 +schedule_in_freebusy
1.21 +same_domain_only
1.22 +EOF
1.23 +echo '10,12,14,16,18:0,15,30,45' > "$PREFS/$USER/permitted_times"
1.24 +echo 'PT60S' > "$PREFS/$USER/freebusy_offers"
1.25 +
1.26 + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \
1.27 +| "$SHOWMAIL" \
1.28 +> out0.tmp
1.29 +
1.30 + grep -q 'METHOD:REPLY' out0.tmp \
1.31 +&& ! grep -q '^FREEBUSY' out0.tmp \
1.32 +&& echo "Success" \
1.33 +|| echo "Failed"
1.34 +
1.35 +# Attempt to schedule an event.
1.36 +
1.37 +"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-outsider.txt" 2>> $ERROR
1.38 +
1.39 + grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \
1.40 +&& echo "Success" \
1.41 +|| echo "Failed"
1.42 +
1.43 +# Present the request to the resource.
1.44 +
1.45 + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-outsider.txt" 2>> $ERROR \
1.46 +| tee out1r.tmp \
1.47 +| "$SHOWMAIL" \
1.48 +> out1.tmp
1.49 +
1.50 + grep -q 'METHOD:REPLY' out1.tmp \
1.51 +&& grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out1.tmp \
1.52 +&& echo "Success" \
1.53 +|| echo "Failed"
1.54 +
1.55 + ! [ -e "$FBFILE" ] \
1.56 +|| ! grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBFILE" \
1.57 +&& echo "Success" \
1.58 +|| echo "Failed"
1.59 +
1.60 +# Relax the scheduling function.
1.61 +
1.62 +cat > "$PREFS/$USER/scheduling_function" <<EOF
1.63 +schedule_in_freebusy
1.64 +EOF
1.65 +
1.66 +# Present the request to the resource.
1.67 +
1.68 + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-outsider.txt" 2>> $ERROR \
1.69 +| tee out2r.tmp \
1.70 +| "$SHOWMAIL" \
1.71 +> out2.tmp
1.72 +
1.73 + grep -q 'METHOD:REPLY' out2.tmp \
1.74 +&& grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out2.tmp \
1.75 +&& echo "Success" \
1.76 +|| echo "Failed"
1.77 +
1.78 + [ -e "$FBFILE" ] \
1.79 +&& grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBFILE" \
1.80 +&& echo "Success" \
1.81 +|| echo "Failed"
1.82 +
1.83 +# Check the free/busy state of the resource again.
1.84 +
1.85 + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \
1.86 +| "$SHOWMAIL" \
1.87 +> out3.tmp
1.88 +
1.89 + grep -q 'METHOD:REPLY' out3.tmp \
1.90 +&& grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T154500Z' out3.tmp \
1.91 +&& echo "Success" \
1.92 +|| echo "Failed"