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