1.1 --- a/tests/test_outgoing_invitation.sh Thu Mar 29 23:28:32 2018 +0200
1.2 +++ b/tests/test_outgoing_invitation.sh Thu Mar 29 23:34:57 2018 +0200
1.3 @@ -3,126 +3,249 @@
1.4 . "`dirname \"$0\"`/common.sh"
1.5
1.6 USER="mailto:paul.boddie@example.com"
1.7 +SENDER=$USER
1.8
1.9 mkdir -p "$PREFS/$USER"
1.10 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
1.11 echo 'share' > "$PREFS/$USER/freebusy_sharing"
1.12 echo '20141010' > "$PREFS/$USER/window_start"
1.13
1.14 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request.txt" 2>> $ERROR
1.15 +# Make a new event.
1.16
1.17 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.18 -| tee out1.tmp \
1.19 -| grep -q "^20141126T150000Z${TAB}20141126T160000Z" \
1.20 -&& echo "Success" \
1.21 -|| echo "Failed"
1.22 +cat > "event_cmd.tmp" <<EOF
1.23 +new
1.24 +period 0 edit 20141126 16 00 00 Europe/Oslo 20141126 17 00 00 Europe/Oslo
1.25 +attendance accept
1.26 +attendee mailto:harvey.horse@example.com
1.27 +attendee mailto:resource-room-confroom@example.com
1.28 +summary Meeting at 4pm
1.29 +finish
1.30 +publish event_self.tmp
1.31 +UID event_uid.tmp
1.32 +EOF
1.33 +
1.34 +text_client "$SENDER" "event_cmd.tmp"
1.35 +
1.36 +# Obtain the event UID.
1.37 +
1.38 +read UID1 < "event_uid.tmp"
1.39 +
1.40 +# Register the event at the sender.
1.41 +
1.42 +outgoing_script "event_self.tmp"
1.43
1.44 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel.txt" 2>> $ERROR
1.45 -echo "Cancel..."
1.46 +# Expect a free/busy period for the sender at the sender.
1.47 +
1.48 +list_script "out1f.tmp" "$SENDER" "freebusy"
1.49 +test_freebusy '20141126T150000Z' '20141126T160000Z' "out1f.tmp"
1.50 +
1.51 +# Cancel the event.
1.52 +
1.53 +cat > "event_cancel_cmd.tmp" <<EOF
1.54 +finish
1.55 +cancel-publish event_cancel.tmp
1.56 +EOF
1.57
1.58 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.59 -> out2.tmp
1.60 +text_client_specific "$SENDER" "event_cancel_cmd.tmp" "$UID1"
1.61 +
1.62 +# Present the cancellation at the sender.
1.63 +
1.64 +outgoing_script "event_cancel.tmp"
1.65
1.66 - ! grep -q '^2' "out2.tmp" \
1.67 -&& echo "Success" \
1.68 -|| echo "Failed"
1.69 +# Expect no free/busy periods for the sender at the sender.
1.70 +
1.71 +list_script "out2f.tmp" "$SENDER" "freebusy"
1.72 +test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out2f.tmp"
1.73 +have_occurrences "$UID1" 0 "out2f.tmp" && success || failed "out2f.tmp"
1.74
1.75 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring.txt" 2>> $ERROR
1.76 -
1.77 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.78 -> out3.tmp
1.79 +# Make a recurring event.
1.80
1.81 - [ `cat "out3.tmp" | wc -l` = '3' ] \
1.82 -&& grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out3.tmp" \
1.83 -&& echo "Success" \
1.84 -|| echo "Failed"
1.85 +cat > "event_recurring_cmd.tmp" <<EOF
1.86 +new
1.87 +period 0 edit 20141010 10 00 00 Europe/Oslo 20141010 11 00 00 Europe/Oslo
1.88 +rrule
1.89 +freq monthly 1
1.90 +selection weekday FR 2 end
1.91 +count 3
1.92 +end
1.93 +attendance accept
1.94 +attendee mailto:resource-room-confroom@example.com
1.95 +summary Recurring event
1.96 +finish
1.97 +publish event_recurring_self.tmp
1.98 +UID event_recurring_uid.tmp
1.99 +EOF
1.100 +
1.101 +text_client "$SENDER" "event_recurring_cmd.tmp"
1.102 +
1.103 +# Obtain the event UID.
1.104 +
1.105 +read UID2 < "event_recurring_uid.tmp"
1.106
1.107 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring-instance.txt" 2>> $ERROR
1.108 +# Register the event at the sender.
1.109 +
1.110 +outgoing_script "event_recurring_self.tmp"
1.111 +
1.112 +# Expect free/busy periods for the sender at the sender.
1.113
1.114 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.115 -> out4.tmp
1.116 +list_script "out3f.tmp" "$SENDER" "freebusy"
1.117 +test_freebusy '20141010T080000Z' '20141010T090000Z' "out3f.tmp"
1.118 +have_occurrences "$UID2" 3 "out3f.tmp" && success || failed "out3f.tmp"
1.119 +
1.120 +# Cancel a recurrence.
1.121
1.122 - [ `cat "out4.tmp" | wc -l` = '2' ] \
1.123 -&& ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "out4.tmp" \
1.124 -&& echo "Success" \
1.125 -|| echo "Failed"
1.126 +cat > "event_cancel_recurring_cmd.tmp" <<EOF
1.127 +period 1 cancel
1.128 +finish
1.129 +publish event_cancel_recurring.tmp
1.130 +EOF
1.131 +
1.132 +text_client_specific "$SENDER" "event_cancel_recurring_cmd.tmp" "$UID2"
1.133 +
1.134 +# Present the cancellation at the sender.
1.135 +
1.136 +outgoing_script "event_cancel_recurring.tmp"
1.137
1.138 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-reschedule-instance.txt" 2>> $ERROR
1.139 +# Expect fewer free/busy periods for the sender at the sender.
1.140 +
1.141 +list_script "out4f.tmp" "$SENDER" "freebusy"
1.142 +test_freebusy '20141010T080000Z' '20141010T090000Z' "out4f.tmp"
1.143 +test_freebusy_missing '20141114T090000Z' '20141114T100000Z' "out4f.tmp"
1.144 +have_occurrences "$UID2" 2 "out4f.tmp" && success || failed "out4f.tmp"
1.145 +
1.146 +# Reschedule an instance.
1.147
1.148 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.149 -> out5.tmp
1.150 +cat > "event_reschedule_cmd.tmp" <<EOF
1.151 +period 0 edit 20141011 10 00 00 Europe/Oslo 20141011 11 00 00 Europe/Oslo
1.152 +finish
1.153 +publish event_reschedule_self.tmp
1.154 +EOF
1.155 +
1.156 +text_client_specific "$SENDER" "event_reschedule_cmd.tmp" "$UID2"
1.157 +
1.158 +# Present the rescheduling at the sender.
1.159 +
1.160 +outgoing_script "event_reschedule_self.tmp"
1.161 +
1.162 +# Expect a rescheduled free/busy period for the sender at the sender.
1.163
1.164 - grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out5.tmp" \
1.165 -&& ! grep -q "^20141010T090000Z${TAB}20141010T100000Z" "out5.tmp" \
1.166 -&& echo "Success" \
1.167 -|| echo "Failed"
1.168 +list_script "out5f.tmp" "$SENDER" "freebusy"
1.169 +test_freebusy '20141011T080000Z' '20141011T090000Z' "out5f.tmp"
1.170 +test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out5f.tmp"
1.171
1.172 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring.txt" 2>> $ERROR
1.173 +# Cancel the event.
1.174 +
1.175 +cat > "event_cancel_recurring_all_cmd.tmp" <<EOF
1.176 +finish
1.177 +cancel-publish event_cancel_recurring_all.tmp
1.178 +EOF
1.179
1.180 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.181 -> out6.tmp
1.182 +text_client_specific "$SENDER" "event_cancel_recurring_all_cmd.tmp" "$UID2"
1.183 +
1.184 +# Present the cancellation at the sender.
1.185 +
1.186 +outgoing_script "event_cancel_recurring_all.tmp"
1.187
1.188 - ! grep -q '^2' "out6.tmp" \
1.189 -&& echo "Success" \
1.190 -|| echo "Failed"
1.191 +# Expect no free/busy periods for the sender at the sender.
1.192 +
1.193 +list_script "out6f.tmp" "$SENDER" "freebusy"
1.194 +test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out6f.tmp"
1.195 +have_occurrences "$UID2" 0 "out6f.tmp" && success || failed "out6f.tmp"
1.196 +
1.197 +# Make a recurring all-day event.
1.198
1.199 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-day.txt" 2>> $ERROR
1.200 +cat > "event_recurring_day_cmd.tmp" <<EOF
1.201 +new
1.202 +period 0 edit 20141010 - 20141010 -
1.203 +rrule
1.204 +freq monthly 1
1.205 +selection weekday FR 2 end
1.206 +count 3
1.207 +end
1.208 +attendance accept
1.209 +attendee mailto:resource-room-confroom@example.com
1.210 +summary Recurring event
1.211 +finish
1.212 +publish event_recurring_day_self.tmp
1.213 +UID event_recurring_day_uid.tmp
1.214 +EOF
1.215
1.216 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.217 -> out7.tmp
1.218 +text_client "$SENDER" "event_recurring_day_cmd.tmp"
1.219 +
1.220 +# Obtain the event UID.
1.221 +
1.222 +read UID3 < "event_recurring_day_uid.tmp"
1.223 +
1.224 +# Register the event at the sender.
1.225
1.226 - [ `cat "out7.tmp" | wc -l` = '3' ] \
1.227 -&& grep -q "^20141211T230000Z${TAB}20141212T230000Z" "out7.tmp" \
1.228 -&& echo "Success" \
1.229 -|| echo "Failed"
1.230 +outgoing_script "event_recurring_day_self.tmp"
1.231 +
1.232 +# Expect free/busy periods for the sender at the sender.
1.233
1.234 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring-day.txt" 2>> $ERROR
1.235 +list_script "out7f.tmp" "$SENDER" "freebusy"
1.236 +test_freebusy '20141211T230000Z' '20141212T230000Z' "out7f.tmp"
1.237 +have_occurrences "$UID3" 3 "out7f.tmp" && success || failed "out7f.tmp"
1.238 +
1.239 +# Cancel the event.
1.240
1.241 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.242 -> out8.tmp
1.243 +cat > "event_cancel_recurring_day_cmd.tmp" <<EOF
1.244 +finish
1.245 +cancel-publish event_cancel_recurring_day.tmp
1.246 +EOF
1.247 +
1.248 +text_client_specific "$SENDER" "event_cancel_recurring_day_cmd.tmp" "$UID3"
1.249
1.250 - ! grep -q '^2' "out8.tmp" \
1.251 -&& echo "Success" \
1.252 -|| echo "Failed"
1.253 +# Present the cancellation at the sender.
1.254 +
1.255 +outgoing_script "event_cancel_recurring_day.tmp"
1.256 +
1.257 +# Expect no free/busy periods for the sender at the sender.
1.258 +
1.259 +list_script "out8f.tmp" "$SENDER" "freebusy"
1.260 +test_freebusy_missing '20141211T230000Z' '20141212T230000Z' "out8f.tmp"
1.261 +have_occurrences "$UID2" 0 "out8f.tmp" && success || failed "out8f.tmp"
1.262
1.263 # Switch time zones.
1.264
1.265 echo 'Europe/Mariehamn' > "$PREFS/$USER/TZID"
1.266
1.267 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring.txt" 2>> $ERROR
1.268 +# Register the recurring event at the sender.
1.269 +
1.270 +outgoing_script "event_recurring_self.tmp"
1.271
1.272 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.273 -> out9.tmp
1.274 +# Expect free/busy periods for the sender at the sender.
1.275 +
1.276 +list_script "out9f.tmp" "$SENDER" "freebusy"
1.277 +test_freebusy '20141010T080000Z' '20141010T090000Z' "out9f.tmp"
1.278 +have_occurrences "$UID2" 3 "out9f.tmp" && success || failed "out9f.tmp"
1.279
1.280 - [ `cat "out9.tmp" | wc -l` = '3' ] \
1.281 -&& grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out9.tmp" \
1.282 -&& echo "Success" \
1.283 -|| echo "Failed"
1.284 +# Present the cancellation of the recurring event at the sender.
1.285
1.286 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring.txt" 2>> $ERROR
1.287 +outgoing_script "event_cancel_recurring_all.tmp"
1.288
1.289 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.290 -> out10.tmp
1.291 +# Expect no free/busy periods for the sender at the sender.
1.292
1.293 - ! grep -q '^2' "out10.tmp" \
1.294 -&& echo "Success" \
1.295 -|| echo "Failed"
1.296 +list_script "out10f.tmp" "$SENDER" "freebusy"
1.297 +test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out10f.tmp"
1.298 +have_occurrences "$UID2" 0 "out10f.tmp" && success || failed "out10f.tmp"
1.299
1.300 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-day.txt" 2>> $ERROR
1.301 +# Register the recurring all-day event at the sender.
1.302
1.303 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.304 -> out11.tmp
1.305 +outgoing_script "event_recurring_day_self.tmp"
1.306 +
1.307 +# Expect free/busy periods for the sender at the sender.
1.308 +# With the changed time zone, the periods will be earlier than before.
1.309
1.310 - [ `cat "out11.tmp" | wc -l` = '3' ] \
1.311 -&& grep -q "^20141211T230000Z${TAB}20141212T230000Z" "out11.tmp" \
1.312 -&& echo "Success" \
1.313 -|| echo "Failed"
1.314 +list_script "out11f.tmp" "$SENDER" "freebusy"
1.315 +test_freebusy '20141211T220000Z' '20141212T220000Z' "out11f.tmp"
1.316 +have_occurrences "$UID3" 3 "out11f.tmp" && success || failed "out11f.tmp"
1.317
1.318 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring-day.txt" 2>> $ERROR
1.319 +# Present the cancellation at the sender.
1.320
1.321 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.322 -> out12.tmp
1.323 +outgoing_script "event_cancel_recurring_day.tmp"
1.324 +
1.325 +# Expect no free/busy periods for the sender at the sender.
1.326
1.327 - ! grep -q '^2' "out12.tmp" \
1.328 -&& echo "Success" \
1.329 -|| echo "Failed"
1.330 +list_script "out12f.tmp" "$SENDER" "freebusy"
1.331 +test_freebusy_missing '20141211T220000Z' '20141212T220000Z' "out12f.tmp"
1.332 +have_occurrences "$UID2" 0 "out12f.tmp" && success || failed "out12f.tmp"