1.1 --- a/tests/test_person_invitation.sh Sat Jan 13 17:25:04 2018 +0100
1.2 +++ b/tests/test_person_invitation.sh Sat Jan 13 17:26:42 2018 +0100
1.3 @@ -11,33 +11,27 @@
1.4
1.5 # Present a free/busy request for all periods to the recipient.
1.6
1.7 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \
1.8 -| "$SHOWMAIL" \
1.9 -> out0.tmp
1.10 +person_script "$TEMPLATES/fb-request-person-all.txt" "out0.tmp"
1.11
1.12 # Expect a reply with no periods.
1.13
1.14 - grep -q 'METHOD:REPLY' out0.tmp \
1.15 -&& ! grep -q '^FREEBUSY' out0.tmp \
1.16 -&& echo "Success" \
1.17 -|| echo "Failed"
1.18 + is_present 'METHOD:REPLY' "out0.tmp" \
1.19 +&& is_absent '^FREEBUSY' "out0.tmp" \
1.20 +&& success || failed "out0.tmp"
1.21
1.22 # Present a free/busy request for periods of interest to the recipient.
1.23
1.24 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person.txt" 2>> $ERROR \
1.25 -| "$SHOWMAIL" \
1.26 -> out1.tmp
1.27 +person_script "$TEMPLATES/fb-request-person.txt" "out1.tmp"
1.28
1.29 # Expect a reply with no periods.
1.30
1.31 - grep -q 'METHOD:REPLY' out1.tmp \
1.32 -&& ! grep -q '^FREEBUSY' out1.tmp \
1.33 -&& echo "Success" \
1.34 -|| echo "Failed"
1.35 + is_present 'METHOD:REPLY' "out1.tmp" \
1.36 +&& is_absent '^FREEBUSY' "out1.tmp" \
1.37 +&& success || failed "out1.tmp"
1.38
1.39 # Make a new event.
1.40
1.41 - cat > event_cmd.tmp <<EOF
1.42 +cat > "event_cmd.tmp" <<EOF
1.43 new
1.44 period 0 edit 20141126 16 00 00 Europe/Oslo 20141126 17 00 00 Europe/Oslo
1.45 attendance accept
1.46 @@ -49,279 +43,194 @@
1.47 UID event_uid.tmp
1.48 EOF
1.49
1.50 - "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo \
1.51 -< event_cmd.tmp \
1.52 -> event_log.tmp
1.53 +text_client "$SENDER" "event_cmd.tmp"
1.54
1.55 # Obtain the event UID.
1.56
1.57 - read UID1 < event_uid.tmp
1.58 +read UID1 < "event_uid.tmp"
1.59
1.60 # Register the event at the sender.
1.61
1.62 - "$OUTGOING_SCRIPT" < event.tmp $ARGS 2>> $ERROR
1.63 +outgoing_script "event_self.tmp"
1.64
1.65 # Present the event to the recipient.
1.66
1.67 - "$PERSON_SCRIPT" $ARGS < event.tmp 2>> $ERROR \
1.68 -| "$SHOWMAIL" \
1.69 -> out2.tmp
1.70 +person_script "event.tmp" "out2.tmp"
1.71
1.72 # Expect no reply because the recipient must handle the request.
1.73
1.74 - ! grep -q 'METHOD:REPLY' out2.tmp \
1.75 -&& echo "Success" \
1.76 -|| echo "Failed"
1.77 +is_absent 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp"
1.78
1.79 # Expect no free/busy periods for the recipient.
1.80
1.81 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.82 -> out2f.tmp
1.83 -
1.84 - ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" out2f.tmp \
1.85 -&& echo "Success" \
1.86 -|| echo "Failed"
1.87 +list_script "out2f.tmp" "$USER" "freebusy"
1.88 +test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out2f.tmp"
1.89
1.90 # Expect free/busy periods for the sender at the recipient.
1.91
1.92 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
1.93 -> out2fo.tmp
1.94 -
1.95 - grep -q "^20141126T150000Z${TAB}20141126T160000Z" out2fo.tmp \
1.96 -&& echo "Success" \
1.97 -|| echo "Failed"
1.98 +list_script "out2fo.tmp" "$USER" "freebusy_other" "$SENDER"
1.99 +test_freebusy '20141126T150000Z' '20141126T160000Z' "out2fo.tmp"
1.100
1.101 # Accept the invitation.
1.102
1.103 - cat > event_accept_cmd.tmp <<EOF
1.104 -0
1.105 +cat > "event_accept_cmd.tmp" <<EOF
1.106 attendance accept
1.107 finish
1.108 update event_accept.tmp
1.109 EOF
1.110
1.111 - "$TEXT_CLIENT" $ARGS -u "$USER" -f event.tmp --echo \
1.112 -< event_accept_cmd.tmp \
1.113 -> event_accept_log.tmp
1.114 +text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1"
1.115
1.116 # Register the acceptance at the recipient.
1.117
1.118 - "$OUTGOING_SCRIPT" < event_accept.tmp $ARGS 2>> $ERROR
1.119 +outgoing_script "event_accept.tmp"
1.120
1.121 # Expect free/busy periods at the recipient.
1.122
1.123 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.124 -> out3f.tmp
1.125 -
1.126 - grep -q "^20141126T150000Z${TAB}20141126T160000Z" out3f.tmp \
1.127 -&& echo "Success" \
1.128 -|| echo "Failed"
1.129 +list_script "out3f.tmp" "$USER" "freebusy"
1.130 +test_freebusy '20141126T150000Z' '20141126T160000Z' "out3f.tmp"
1.131
1.132 # Make another event at the same time.
1.133
1.134 - sed \
1.135 +sed \
1.136 's/summary Meeting at 4pm/summary A conflicting meeting at 4pm/;'\
1.137 's/update event.tmp/update event_conflicting.tmp/;'\
1.138 -'s/UID event_uid.tmp/UID event_conflicting_uid.tmp/' event_cmd.tmp \
1.139 -> event_conflicting_cmd.tmp
1.140 +'s/UID event_uid.tmp/UID event_conflicting_uid.tmp/' "event_cmd.tmp" \
1.141 +> "event_conflicting_cmd.tmp"
1.142
1.143 - "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo \
1.144 -< event_conflicting_cmd.tmp \
1.145 -> event_conflicting_log.tmp
1.146 +text_client "$SENDER" "event_conflicting_cmd.tmp"
1.147
1.148 # Obtain the event UID.
1.149
1.150 - read UID2 < event_conflicting_uid.tmp
1.151 +read UID2 < "event_conflicting_uid.tmp"
1.152
1.153 # Present the event to the recipient.
1.154
1.155 - "$PERSON_SCRIPT" $ARGS < event_conflicting.tmp 2>> $ERROR \
1.156 -| "$SHOWMAIL" \
1.157 -> out4.tmp
1.158 +person_script "event_conflicting.tmp" "out4.tmp"
1.159
1.160 # Expect no reply because the recipient must handle the request.
1.161
1.162 - ! grep -q 'METHOD:REPLY' out4.tmp \
1.163 -&& echo "Success" \
1.164 -|| echo "Failed"
1.165 +is_absent 'METHOD:REPLY' "out4.tmp" && success || failed "out4.tmp"
1.166
1.167 # Expect no free/busy periods for the recipient for this event.
1.168
1.169 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.170 -> out4f.tmp
1.171 -
1.172 - ! grep -q "$UID2" out4f.tmp \
1.173 -&& echo "Success" \
1.174 -|| echo "Failed"
1.175 +list_script "out4f.tmp" "$USER" "freebusy"
1.176 +is_absent "$UID2" "out4f.tmp" && success || failed "out4f.tmp"
1.177
1.178 # Expect free/busy periods for the sender at the recipient for this event.
1.179
1.180 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
1.181 -> out4fo.tmp
1.182 -
1.183 - grep -q "$UID2" out4fo.tmp \
1.184 -&& echo "Success" \
1.185 -|| echo "Failed"
1.186 +list_script "out4fo.tmp" "$USER" "freebusy_other" "$SENDER"
1.187 +is_present "$UID2" "out4fo.tmp" && success || failed "out4fo.tmp"
1.188
1.189 # Decline the invitation.
1.190
1.191 - cat > event_decline_cmd.tmp <<EOF
1.192 -0
1.193 +cat > "event_decline_cmd.tmp" <<EOF
1.194 attendance decline
1.195 finish
1.196 update event_decline.tmp
1.197 EOF
1.198
1.199 - "$TEXT_CLIENT" $ARGS -u "$USER" -f event_conflicting.tmp --echo \
1.200 -< event_decline_cmd.tmp \
1.201 -> event_decline_log.tmp
1.202 +text_client_specific "$USER" "event_decline_cmd.tmp" "$UID2"
1.203
1.204 # Register the rejection at the recipient.
1.205
1.206 - "$OUTGOING_SCRIPT" < event_decline.tmp $ARGS 2>> $ERROR
1.207 +outgoing_script "event_decline.tmp"
1.208
1.209 # Expect free/busy periods only for the original event, not the last one.
1.210
1.211 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.212 -> out5f.tmp
1.213 -
1.214 - grep -q "$UID1" out5f.tmp \
1.215 -&& ! grep -q "$UID2" out5f.tmp \
1.216 -&& echo "Success" \
1.217 -|| echo "Failed"
1.218 + list_script "out5f.tmp" "$USER" "freebusy"
1.219 + is_present "$UID1" "out5f.tmp" \
1.220 +&& is_absent "$UID2" "out5f.tmp" \
1.221 +&& success || failed "out5f.tmp"
1.222
1.223 # Cancel the event for a recipient.
1.224
1.225 - cat > event_cancel_cmd.tmp <<EOF
1.226 -0
1.227 +cat > "event_cancel_cmd.tmp" <<EOF
1.228 attendee mailto:vincent.vole@example.com remove
1.229 finish
1.230 cancel event_cancel.tmp
1.231 EOF
1.232
1.233 - "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo -f event.tmp \
1.234 -< event_cancel_cmd.tmp \
1.235 -> event_cancel_log.tmp
1.236 +text_client_specific "$SENDER" "event_cancel_cmd.tmp" "$UID1"
1.237
1.238 # Present the cancellation to the recipient.
1.239
1.240 - "$PERSON_SCRIPT" $ARGS < event_cancel.tmp 2>> $ERROR \
1.241 -| "$SHOWMAIL" \
1.242 -> out6.tmp
1.243 +person_script "event_cancel.tmp" "out6.tmp"
1.244
1.245 # Expect no reply because the recipient must handle the request.
1.246
1.247 - ! grep -q 'METHOD:REPLY' out6.tmp \
1.248 -&& echo "Success" \
1.249 -|| echo "Failed"
1.250 +is_absent 'METHOD:REPLY' "out6.tmp" && success || failed "out6.tmp"
1.251
1.252 # Expect no free/busy periods for the recipient.
1.253
1.254 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.255 -> out6f.tmp
1.256 -
1.257 - ! grep -q "$UID1" out6f.tmp \
1.258 -&& echo "Success" \
1.259 -|| echo "Failed"
1.260 +list_script "out6f.tmp" "$USER" "freebusy"
1.261 +is_absent "$UID1" "out6f.tmp" && success || failed "out6f.tmp"
1.262
1.263 # Expect free/busy periods for the sender at the recipient for this event since
1.264 # only the recipient was uninvited.
1.265
1.266 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
1.267 -> out6fo.tmp
1.268 -
1.269 - grep -q "$UID1" out6fo.tmp \
1.270 -&& echo "Success" \
1.271 -|| echo "Failed"
1.272 +list_script "out6fo.tmp" "$USER" "freebusy_other" "$SENDER"
1.273 +is_present "$UID1" "out6fo.tmp" && success || failed "out6fo.tmp"
1.274
1.275 # Cancel the event for all recipients.
1.276
1.277 - cat > event_cancel_all_cmd.tmp <<EOF
1.278 -0
1.279 +cat > "event_cancel_all_cmd.tmp" <<EOF
1.280 finish
1.281 cancel event_cancel_all.tmp
1.282 EOF
1.283
1.284 - "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo -f event.tmp \
1.285 -< event_cancel_all_cmd.tmp \
1.286 -> event_cancel_all_log.tmp
1.287 +text_client_specific "$SENDER" "event_cancel_all_cmd.tmp" "$UID1"
1.288
1.289 # Present the cancellation to the recipient.
1.290
1.291 - "$PERSON_SCRIPT" $ARGS < "event_cancel_all.tmp" 2>> $ERROR \
1.292 -| "$SHOWMAIL" \
1.293 -> out7.tmp
1.294 +person_script "event_cancel_all.tmp" "out7.tmp"
1.295
1.296 # Expect no reply because the recipient must handle the request.
1.297
1.298 - ! grep -q 'METHOD:REPLY' out7.tmp \
1.299 -&& echo "Success" \
1.300 -|| echo "Failed"
1.301 +is_absent 'METHOD:REPLY' "out7.tmp" && success || failed "out7.tmp"
1.302
1.303 # Expect no free/busy periods for the recipient.
1.304
1.305 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.306 -> out7f.tmp
1.307 -
1.308 - ! grep -q "$UID1" "out7f.tmp" \
1.309 -&& echo "Success" \
1.310 -|| echo "Failed"
1.311 +list_script "out7f.tmp" "$USER" "freebusy"
1.312 +is_absent "$UID1" "out7f.tmp" && success || failed "out7f.tmp"
1.313
1.314 # Expect no free/busy periods for the sender at the recipient for this event.
1.315
1.316 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
1.317 -> out7fo.tmp
1.318 -
1.319 - ! grep -q "$UID1" "out7fo.tmp" \
1.320 -&& echo "Success" \
1.321 -|| echo "Failed"
1.322 +list_script "out7fo.tmp" "$USER" "freebusy_other" "$SENDER"
1.323 +is_absent "$UID1" "out7fo.tmp" && success || failed "out7fo.tmp"
1.324
1.325 # Create a message from another sender that is largely a copy of the original
1.326 # event trying to organise the event using someone else's identity.
1.327
1.328 - sed \
1.329 +sed \
1.330 's/summary Meeting at 4pm/summary A spoofed meeting at 4pm/;'\
1.331 's/update event.tmp/update event_spoofed.tmp/;'\
1.332 -'s/UID event_uid.tmp/UID event_spoofed_uid.tmp/' event_cmd.tmp \
1.333 -> event_spoofed_cmd.tmp
1.334 +'s/UID event_uid.tmp/UID event_spoofed_uid.tmp/' "event_cmd.tmp" \
1.335 +> "event_spoofed_cmd.tmp"
1.336
1.337 - "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo \
1.338 -< event_spoofed_cmd.tmp \
1.339 -> event_spoofed_log.tmp
1.340 +text_client "$SENDER" "event_spoofed_cmd.tmp"
1.341
1.342 # Obtain the event UID.
1.343
1.344 - read UID3 < event_spoofed_uid.tmp
1.345 +read UID3 < "event_spoofed_uid.tmp"
1.346
1.347 - sed 's/From: paul.boddie/From: harvey.horse/' event_spoofed.tmp \
1.348 -> event_spoofed_ready.tmp
1.349 +sed 's/From: paul.boddie/From: harvey.horse/' "event_spoofed.tmp" \
1.350 +> "event_spoofed_ready.tmp"
1.351
1.352 # Present the event to the recipient.
1.353
1.354 - "$PERSON_SCRIPT" $ARGS < "event_spoofed_ready.tmp" 2>> $ERROR \
1.355 -| "$SHOWMAIL" \
1.356 -> out8.tmp
1.357 +person_script "event_spoofed_ready.tmp" "out8.tmp"
1.358
1.359 # Expect no reply because the recipient must handle the request.
1.360
1.361 - ! grep -q 'METHOD:REPLY' out8.tmp \
1.362 -&& echo "Success" \
1.363 -|| echo "Failed"
1.364 +is_absent 'METHOD:REPLY' "out8.tmp" && success || failed "out8.tmp"
1.365
1.366 # Expect no free/busy periods for the recipient.
1.367
1.368 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
1.369 -> out8f.tmp
1.370 -
1.371 - ! grep -q "$UID3" "out8f.tmp" \
1.372 -&& echo "Success" \
1.373 -|| echo "Failed"
1.374 +list_script "out8f.tmp" "$USER" "freebusy"
1.375 +is_absent "$UID3" "out8f.tmp" && success || failed "out8f.tmp"
1.376
1.377 # Expect no free/busy periods for the sender at the recipient.
1.378
1.379 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
1.380 -> out8fo.tmp
1.381 -
1.382 - ! grep -q "$UID3" "out8fo.tmp" \
1.383 -&& echo "Success" \
1.384 -|| echo "Failed"
1.385 +list_script "out8fo.tmp" "$USER" "freebusy_other" "$SENDER"
1.386 +is_absent "$UID3" "out8fo.tmp" && success || failed "out8fo.tmp"