1.1 --- a/tests/test_person_invitation_add.sh Sat Jan 13 17:25:04 2018 +0100
1.2 +++ b/tests/test_person_invitation_add.sh Sat Jan 13 17:26:42 2018 +0100
1.3 @@ -13,168 +13,183 @@
1.4 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
1.5 echo 'always' > "$PREFS/$SENDER/event_refreshing"
1.6
1.7 -# Test event request registration in the outgoing handler.
1.8 -
1.9 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR
1.10 -
1.11 - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
1.12 -> out1f.tmp
1.13 -
1.14 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out1f.tmp" \
1.15 -&& echo "Success" \
1.16 -|| echo "Failed"
1.17 -
1.18 -# Present the request to the recipient.
1.19 -
1.20 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR \
1.21 -| "$SHOWMAIL" \
1.22 -> out2.tmp
1.23 -
1.24 - ! grep -q 'METHOD:REPLY' out2.tmp \
1.25 -&& echo "Success" \
1.26 -|| echo "Failed"
1.27 -
1.28 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.29 -> out2f.tmp
1.30 -
1.31 - ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out2f.tmp" \
1.32 -&& echo "Success" \
1.33 -|| echo "Failed"
1.34 -
1.35 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
1.36 -> out2fo.tmp
1.37 -
1.38 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out2fo.tmp" \
1.39 -&& echo "Success" \
1.40 -|| echo "Failed"
1.41 -
1.42 -# Test acceptance and registration in the outgoing handler.
1.43 +# Make a new event.
1.44
1.45 - "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \
1.46 -| tee out3.tmp \
1.47 -| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
1.48 -
1.49 - "$SHOWMAIL" < out3.tmp | grep -q 'METHOD:REPLY' \
1.50 -&& echo "Success" \
1.51 -|| echo "Failed"
1.52 -
1.53 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.54 -> out3f.tmp
1.55 -
1.56 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out3f.tmp" \
1.57 -&& echo "Success" \
1.58 -|| echo "Failed"
1.59 -
1.60 -# Present the result to the recipient.
1.61 +cat > "event_cmd.tmp" <<EOF
1.62 +new
1.63 +period 0 edit 20141010 10 00 00 Europe/Oslo 20141010 11 00 00 Europe/Oslo
1.64 +rrule
1.65 +freq monthly 1
1.66 +selection weekday FR 2 end
1.67 +count 3
1.68 +end
1.69 +attendance accept
1.70 +attendee mailto:vincent.vole@example.com
1.71 +summary Recurring event
1.72 +finish
1.73 +update event.tmp
1.74 +publish event_self.tmp
1.75 +UID event_uid.tmp
1.76 +EOF
1.77
1.78 - "$PERSON_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \
1.79 -| "$SHOWMAIL" \
1.80 -> out4.tmp
1.81 +text_client "$SENDER" "event_cmd.tmp"
1.82
1.83 - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER" \
1.84 -> out4fo.tmp
1.85 +# Obtain the event UID.
1.86
1.87 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out4fo.tmp" \
1.88 -&& echo "Success" \
1.89 -|| echo "Failed"
1.90 +read UID1 < "event_uid.tmp"
1.91
1.92 -# Attempt to add an occurrence to the event.
1.93 +# Register the event at the sender.
1.94
1.95 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring.txt" 2>> $ERROR
1.96 +outgoing_script "event_self.tmp"
1.97
1.98 - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
1.99 -> out4f.tmp
1.100 +# Expect free/busy periods for the sender.
1.101
1.102 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out4f.tmp" \
1.103 -&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out4f.tmp" \
1.104 -&& echo "Success" \
1.105 -|| echo "Failed"
1.106 +list_script "out1f.tmp" "$SENDER" "freebusy"
1.107 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out1f.tmp"
1.108
1.109 # Present the request to the recipient.
1.110
1.111 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring.txt" 2>> $ERROR \
1.112 -| "$SHOWMAIL" \
1.113 -> out5.tmp
1.114 +person_script "event.tmp" "out2.tmp"
1.115 +
1.116 +# Expect no reply because the recipient must handle the request.
1.117 +
1.118 +is_absent 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp"
1.119 +
1.120 +# Expect no free/busy periods for the recipient.
1.121
1.122 - grep -q 'METHOD:REFRESH' out5.tmp \
1.123 -&& echo "Success" \
1.124 -|| echo "Failed"
1.125 +list_script "out2f.tmp" "$USER" "freebusy"
1.126 +test_freebusy_missing '20141212T090000Z' '20141212T100000Z' "out2f.tmp"
1.127 +
1.128 +# Expect free/busy periods for the sender at the recipient.
1.129 +
1.130 +list_script "out2fo.tmp" "$USER" "freebusy_other" "$SENDER"
1.131 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out2fo.tmp"
1.132
1.133 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.134 -> out5f.tmp
1.135 +# Accept the invitation.
1.136 +
1.137 +cat > "event_accept_cmd.tmp" <<EOF
1.138 +attendance accept
1.139 +finish
1.140 +update event_accept.tmp
1.141 +EOF
1.142
1.143 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out5f.tmp" \
1.144 -&& ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out5f.tmp" \
1.145 -&& echo "Success" \
1.146 -|| echo "Failed"
1.147 +text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1"
1.148 +
1.149 +# Register the acceptance at the recipient.
1.150 +
1.151 +outgoing_script "event_accept.tmp"
1.152 +
1.153 +# Test the nature of the acceptance message.
1.154
1.155 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
1.156 -> out5fo.tmp
1.157 + showmail "event_accept.tmp" | is_present 'METHOD:REPLY' \
1.158 +&& success || failed "event_accept.tmp"
1.159 +
1.160 +# Expect free/busy periods at the recipient.
1.161 +
1.162 +list_script "out3f.tmp" "$USER" "freebusy"
1.163 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out3f.tmp"
1.164
1.165 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out5fo.tmp" \
1.166 -&& ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out5fo.tmp" \
1.167 -&& echo "Success" \
1.168 -|| echo "Failed"
1.169 +# Present the result to the sender.
1.170 +
1.171 +person_script "event_accept.tmp" "out4.tmp"
1.172 +
1.173 +# Expect free/busy periods at the sender for the recipient.
1.174 +
1.175 +list_script "out4fo.tmp" "$SENDER" "freebusy_other" "$USER"
1.176 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out4fo.tmp"
1.177
1.178 -# Present the refresh message to the organiser.
1.179 +# Attempt to add an occurrence to the event.
1.180 +
1.181 +cat > "event_cmd2.tmp" <<EOF
1.182 +period new 20150109 10 00 00 Europe/Oslo 20150109 11 00 00 Europe/Oslo
1.183 +finish
1.184 +update event_add.tmp
1.185 +EOF
1.186 +
1.187 +text_client_specific "$SENDER" "event_cmd2.tmp" "$UID1"
1.188
1.189 - "$PERSON_SCRIPT" $ARGS < out5.tmp 2>> $ERROR \
1.190 -| tee out6r.tmp \
1.191 -| "$SHOWMAIL" \
1.192 -> out6.tmp
1.193 +# Register the new occurrence at the sender.
1.194 +
1.195 +outgoing_script "event_add.tmp"
1.196
1.197 - grep -q 'METHOD:REQUEST' out6.tmp \
1.198 -&& echo "Success" \
1.199 -|| echo "Failed"
1.200 +# Expect free/busy periods for the event at the sender.
1.201 +
1.202 +list_script "out4f.tmp" "$SENDER" "freebusy"
1.203 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out4f.tmp"
1.204 +test_freebusy '20150109T090000Z' '20150109T100000Z' "out4f.tmp"
1.205
1.206 # Present the request to the recipient.
1.207
1.208 - "$PERSON_SCRIPT" $ARGS < out6r.tmp 2>> $ERROR \
1.209 -| "$SHOWMAIL" \
1.210 -> out7.tmp
1.211 +person_script "event_add.tmp" "out5.tmp"
1.212 +
1.213 +# Expect a response demanding a refreshed event.
1.214 +
1.215 +is_present 'METHOD:REFRESH' "out5.tmp" && success || failed "out5.tmp"
1.216 +
1.217 +# Expect no new free/busy period for the event at the recipient.
1.218
1.219 - ! grep -q 'METHOD:REPLY' out7.tmp \
1.220 -&& echo "Success" \
1.221 -|| echo "Failed"
1.222 +list_script "out5f.tmp" "$USER" "freebusy"
1.223 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out5f.tmp"
1.224 +test_freebusy_missing '20150109T090000Z' '20150109T100000Z' "out5f.tmp"
1.225
1.226 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.227 -> out7f.tmp
1.228 +list_script "out5fo.tmp" "$USER" "freebusy_other" "$SENDER"
1.229 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out5fo.tmp"
1.230 +test_freebusy_missing '20150109T090000Z' '20150109T100000Z' "out5fo.tmp"
1.231 +
1.232 +# Present the refresh message to the organiser.
1.233 +
1.234 +person_script "out5.tmp" "out6.tmp" "out6r.tmp"
1.235 +
1.236 +# Expect a new event request from the organiser.
1.237
1.238 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out7f.tmp" \
1.239 -&& ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out7f.tmp" \
1.240 -&& echo "Success" \
1.241 -|| echo "Failed"
1.242 +is_present 'METHOD:REQUEST' "out6.tmp" && success || failed "out6.tmp"
1.243 +
1.244 +# Present the request to the recipient.
1.245 +
1.246 +person_script "out6r.tmp" "out7.tmp"
1.247 +
1.248 +# Expect no reply because the recipient must handle the request.
1.249 +
1.250 +is_absent 'METHOD:REPLY' "out7.tmp" && success || failed "out7.tmp"
1.251
1.252 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
1.253 -> out7fo.tmp
1.254 +# Expect no new free/busy period for the event at the recipient.
1.255 +
1.256 +list_script "out7f.tmp" "$USER" "freebusy"
1.257 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out7f.tmp"
1.258 +test_freebusy_missing '20150109T090000Z' '20150109T100000Z' "out7f.tmp"
1.259
1.260 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out7fo.tmp" \
1.261 -&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out7fo.tmp" \
1.262 -&& echo "Success" \
1.263 -|| echo "Failed"
1.264 +# Expect the new free/busy period for the sender at the recipient.
1.265 +
1.266 +list_script "out7fo.tmp" "$USER" "freebusy_other" "$SENDER"
1.267 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out7fo.tmp"
1.268 +test_freebusy '20150109T090000Z' '20150109T100000Z' "out7fo.tmp"
1.269
1.270 # Test acceptance and registration in the outgoing handler.
1.271
1.272 - "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \
1.273 -| tee out8.tmp \
1.274 -| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
1.275 +text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1"
1.276 +outgoing_script "event_accept.tmp"
1.277 +
1.278 +# Accept the invitation.
1.279
1.280 - "$SHOWMAIL" < out8.tmp | grep -q 'METHOD:REPLY' \
1.281 -&& echo "Success" \
1.282 -|| echo "Failed"
1.283 +cat > "event_accept_cmd2.tmp" <<EOF
1.284 +attendance accept
1.285 +finish
1.286 +update event_accept2.tmp
1.287 +EOF
1.288
1.289 - "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" "20150109T090000Z" 2>> $ERROR \
1.290 -| tee out9.tmp \
1.291 -| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
1.292 +text_client_specific "$USER" "event_accept_cmd2.tmp" "$UID1" '20150109T090000Z'
1.293
1.294 - "$SHOWMAIL" < out9.tmp | grep -q 'METHOD:REPLY' \
1.295 -&& echo "Success" \
1.296 -|| echo "Failed"
1.297 +# Register the acceptance at the recipient.
1.298 +
1.299 +outgoing_script "event_accept2.tmp"
1.300 +
1.301 +# Test the nature of the acceptance message.
1.302
1.303 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.304 -> out9f.tmp
1.305 + showmail "event_accept2.tmp" | is_present 'METHOD:REPLY' \
1.306 +&& success || failed "event_accept2.tmp"
1.307
1.308 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out9f.tmp" \
1.309 -&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out9f.tmp" \
1.310 -&& echo "Success" \
1.311 -|| echo "Failed"
1.312 +# Expect the new free/busy period at the recipient.
1.313 +
1.314 +list_script "out9f.tmp" "$USER" "freebusy"
1.315 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out9f.tmp"
1.316 +test_freebusy '20150109T090000Z' '20150109T100000Z' "out9f.tmp"