1.1 --- a/tests/common.sh Wed Nov 01 23:27:40 2017 +0100
1.2 +++ b/tests/common.sh Tue Nov 07 22:04:54 2017 +0100
1.3 @@ -31,6 +31,8 @@
1.4 SET_QUOTA_LIMITS="$BASE_DIR/tools/set_quota_limits.py"
1.5 SET_QUOTA_LIMITS_ARGS="-T $STORE_TYPE -j $JOURNAL"
1.6
1.7 +TEXT_CLIENT="$BASE_DIR/imip_text_client.py"
1.8 +
1.9 TAB=`printf '\t'`
1.10
1.11 PYTHONPATH="$BASE_DIR"
2.1 --- a/tests/test_person_invitation.sh Wed Nov 01 23:27:40 2017 +0100
2.2 +++ b/tests/test_person_invitation.sh Tue Nov 07 22:04:54 2017 +0100
2.3 @@ -9,153 +9,319 @@
2.4 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
2.5 echo 'share' > "$PREFS/$USER/freebusy_sharing"
2.6
2.7 +# Present a free/busy request for all periods to the recipient.
2.8 +
2.9 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \
2.10 | "$SHOWMAIL" \
2.11 > out0.tmp
2.12
2.13 +# Expect a reply with no periods.
2.14 +
2.15 grep -q 'METHOD:REPLY' out0.tmp \
2.16 && ! grep -q '^FREEBUSY' out0.tmp \
2.17 && echo "Success" \
2.18 || echo "Failed"
2.19
2.20 +# Present a free/busy request for periods of interest to the recipient.
2.21 +
2.22 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person.txt" 2>> $ERROR \
2.23 | "$SHOWMAIL" \
2.24 > out1.tmp
2.25
2.26 +# Expect a reply with no periods.
2.27 +
2.28 grep -q 'METHOD:REPLY' out1.tmp \
2.29 && ! grep -q '^FREEBUSY' out1.tmp \
2.30 && echo "Success" \
2.31 || echo "Failed"
2.32
2.33 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR \
2.34 +# Make a new event.
2.35 +
2.36 + cat > event_cmd.tmp <<EOF
2.37 +new
2.38 +period 0 edit 20141126 16 00 00 Europe/Oslo 20141126 17 00 00 Europe/Oslo
2.39 +attendance accept
2.40 +attendee mailto:vincent.vole@example.com
2.41 +summary Meeting at 4pm
2.42 +finish
2.43 +update event.tmp
2.44 +publish event_self.tmp
2.45 +UID event_uid.tmp
2.46 +EOF
2.47 +
2.48 + "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo \
2.49 +< event_cmd.tmp \
2.50 +> event_log.tmp
2.51 +
2.52 +# Obtain the event UID.
2.53 +
2.54 + read UID1 < event_uid.tmp
2.55 +
2.56 +# Register the event at the sender.
2.57 +
2.58 + "$OUTGOING_SCRIPT" < event.tmp $ARGS 2>> $ERROR
2.59 +
2.60 +# Present the event to the recipient.
2.61 +
2.62 + "$PERSON_SCRIPT" $ARGS < event.tmp 2>> $ERROR \
2.63 | "$SHOWMAIL" \
2.64 > out2.tmp
2.65
2.66 +# Expect no reply because the recipient must handle the request.
2.67 +
2.68 ! grep -q 'METHOD:REPLY' out2.tmp \
2.69 && echo "Success" \
2.70 || echo "Failed"
2.71
2.72 +# Expect no free/busy periods for the recipient.
2.73 +
2.74 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.75 > out2f.tmp
2.76
2.77 - ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out2f.tmp" \
2.78 + ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" out2f.tmp \
2.79 && echo "Success" \
2.80 || echo "Failed"
2.81
2.82 +# Expect free/busy periods for the sender at the recipient.
2.83 +
2.84 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
2.85 > out2fo.tmp
2.86
2.87 - grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out2fo.tmp" \
2.88 + grep -q "^20141126T150000Z${TAB}20141126T160000Z" out2fo.tmp \
2.89 && echo "Success" \
2.90 || echo "Failed"
2.91
2.92 - "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event6@example.com" 2>> $ERROR \
2.93 -| tee out3.tmp \
2.94 -| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
2.95 +# Accept the invitation.
2.96 +
2.97 + cat > event_accept_cmd.tmp <<EOF
2.98 +0
2.99 +attendance accept
2.100 +finish
2.101 +update event_accept.tmp
2.102 +EOF
2.103 +
2.104 + "$TEXT_CLIENT" $ARGS -u "$USER" -f event.tmp --echo \
2.105 +< event_accept_cmd.tmp \
2.106 +> event_accept_log.tmp
2.107 +
2.108 +# Register the acceptance at the recipient.
2.109 +
2.110 + "$OUTGOING_SCRIPT" < event_accept.tmp $ARGS 2>> $ERROR
2.111 +
2.112 +# Expect free/busy periods at the recipient.
2.113
2.114 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.115 > out3f.tmp
2.116
2.117 - grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out3f.tmp" \
2.118 + grep -q "^20141126T150000Z${TAB}20141126T160000Z" out3f.tmp \
2.119 && echo "Success" \
2.120 || echo "Failed"
2.121
2.122 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-conflict.txt" 2>> $ERROR \
2.123 +# Make another event at the same time.
2.124 +
2.125 + sed \
2.126 +'s/summary Meeting at 4pm/summary A conflicting meeting at 4pm/;'\
2.127 +'s/update event.tmp/update event_conflicting.tmp/;'\
2.128 +'s/UID event_uid.tmp/UID event_conflicting_uid.tmp/' event_cmd.tmp \
2.129 +> event_conflicting_cmd.tmp
2.130 +
2.131 + "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo \
2.132 +< event_conflicting_cmd.tmp \
2.133 +> event_conflicting_log.tmp
2.134 +
2.135 +# Obtain the event UID.
2.136 +
2.137 + read UID2 < event_conflicting_uid.tmp
2.138 +
2.139 +# Present the event to the recipient.
2.140 +
2.141 + "$PERSON_SCRIPT" $ARGS < event_conflicting.tmp 2>> $ERROR \
2.142 | "$SHOWMAIL" \
2.143 > out4.tmp
2.144
2.145 +# Expect no reply because the recipient must handle the request.
2.146 +
2.147 ! grep -q 'METHOD:REPLY' out4.tmp \
2.148 && echo "Success" \
2.149 || echo "Failed"
2.150
2.151 +# Expect no free/busy periods for the recipient for this event.
2.152 +
2.153 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.154 > out4f.tmp
2.155
2.156 - ! grep -q "event7@example.com" "out4f.tmp" \
2.157 + ! grep -q "$UID2" out4f.tmp \
2.158 && echo "Success" \
2.159 || echo "Failed"
2.160
2.161 +# Expect free/busy periods for the sender at the recipient for this event.
2.162 +
2.163 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
2.164 > out4fo.tmp
2.165
2.166 - grep -q "event7@example.com" "out4fo.tmp" \
2.167 + grep -q "$UID2" out4fo.tmp \
2.168 && echo "Success" \
2.169 || echo "Failed"
2.170
2.171 - "$DECLINE_SCRIPT" $DECLINE_ARGS "$USER" "event7@example.com" 2>> $ERROR \
2.172 -| tee out5.tmp \
2.173 -| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
2.174 +# Decline the invitation.
2.175 +
2.176 + cat > event_decline_cmd.tmp <<EOF
2.177 +0
2.178 +attendance decline
2.179 +finish
2.180 +update event_decline.tmp
2.181 +EOF
2.182 +
2.183 + "$TEXT_CLIENT" $ARGS -u "$USER" -f event_conflicting.tmp --echo \
2.184 +< event_decline_cmd.tmp \
2.185 +> event_decline_log.tmp
2.186 +
2.187 +# Register the rejection at the recipient.
2.188 +
2.189 + "$OUTGOING_SCRIPT" < event_decline.tmp $ARGS 2>> $ERROR
2.190 +
2.191 +# Expect free/busy periods only for the original event, not the last one.
2.192
2.193 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.194 > out5f.tmp
2.195
2.196 - grep -q "event6@example.com" "out5f.tmp" \
2.197 -&& ! grep -q "event7@example.com" "out5f.tmp" \
2.198 + grep -q "$UID1" out5f.tmp \
2.199 +&& ! grep -q "$UID2" out5f.tmp \
2.200 && echo "Success" \
2.201 || echo "Failed"
2.202
2.203 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person.txt" 2>> $ERROR \
2.204 +# Cancel the event for a recipient.
2.205 +
2.206 + cat > event_cancel_cmd.tmp <<EOF
2.207 +0
2.208 +attendee mailto:vincent.vole@example.com remove
2.209 +finish
2.210 +cancel event_cancel.tmp
2.211 +EOF
2.212 +
2.213 + "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo -f event.tmp \
2.214 +< event_cancel_cmd.tmp \
2.215 +> event_cancel_log.tmp
2.216 +
2.217 +# Present the cancellation to the recipient.
2.218 +
2.219 + "$PERSON_SCRIPT" $ARGS < event_cancel.tmp 2>> $ERROR \
2.220 | "$SHOWMAIL" \
2.221 > out6.tmp
2.222
2.223 +# Expect no reply because the recipient must handle the request.
2.224 +
2.225 ! grep -q 'METHOD:REPLY' out6.tmp \
2.226 && echo "Success" \
2.227 || echo "Failed"
2.228
2.229 +# Expect no free/busy periods for the recipient.
2.230 +
2.231 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.232 > out6f.tmp
2.233
2.234 - ! grep -q "event6@example.com" "out6f.tmp" \
2.235 + ! grep -q "$UID1" out6f.tmp \
2.236 && echo "Success" \
2.237 || echo "Failed"
2.238
2.239 +# Expect free/busy periods for the sender at the recipient for this event since
2.240 +# only the recipient was uninvited.
2.241 +
2.242 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
2.243 > out6fo.tmp
2.244
2.245 - grep -q "event6@example.com" "out6fo.tmp" \
2.246 + grep -q "$UID1" out6fo.tmp \
2.247 && echo "Success" \
2.248 || echo "Failed"
2.249
2.250 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-all.txt" 2>> $ERROR \
2.251 +# Cancel the event for all recipients.
2.252 +
2.253 + cat > event_cancel_all_cmd.tmp <<EOF
2.254 +0
2.255 +finish
2.256 +cancel event_cancel_all.tmp
2.257 +EOF
2.258 +
2.259 + "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo -f event.tmp \
2.260 +< event_cancel_all_cmd.tmp \
2.261 +> event_cancel_all_log.tmp
2.262 +
2.263 +# Present the cancellation to the recipient.
2.264 +
2.265 + "$PERSON_SCRIPT" $ARGS < "event_cancel_all.tmp" 2>> $ERROR \
2.266 | "$SHOWMAIL" \
2.267 > out7.tmp
2.268
2.269 +# Expect no reply because the recipient must handle the request.
2.270 +
2.271 ! grep -q 'METHOD:REPLY' out7.tmp \
2.272 && echo "Success" \
2.273 || echo "Failed"
2.274
2.275 +# Expect no free/busy periods for the recipient.
2.276 +
2.277 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.278 > out7f.tmp
2.279
2.280 - ! grep -q "event6@example.com" "out7f.tmp" \
2.281 + ! grep -q "$UID1" "out7f.tmp" \
2.282 && echo "Success" \
2.283 || echo "Failed"
2.284
2.285 +# Expect no free/busy periods for the sender at the recipient for this event.
2.286 +
2.287 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
2.288 > out7fo.tmp
2.289
2.290 - ! grep -q "event6@example.com" "out7fo.tmp" \
2.291 + ! grep -q "$UID1" "out7fo.tmp" \
2.292 && echo "Success" \
2.293 || echo "Failed"
2.294
2.295 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-spoofed.txt" 2>> $ERROR \
2.296 +# Create a message from another sender that is largely a copy of the original
2.297 +# event trying to organise the event using someone else's identity.
2.298 +
2.299 + sed \
2.300 +'s/summary Meeting at 4pm/summary A spoofed meeting at 4pm/;'\
2.301 +'s/update event.tmp/update event_spoofed.tmp/;'\
2.302 +'s/UID event_uid.tmp/UID event_spoofed_uid.tmp/' event_cmd.tmp \
2.303 +> event_spoofed_cmd.tmp
2.304 +
2.305 + "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo \
2.306 +< event_spoofed_cmd.tmp \
2.307 +> event_spoofed_log.tmp
2.308 +
2.309 +# Obtain the event UID.
2.310 +
2.311 + read UID3 < event_spoofed_uid.tmp
2.312 +
2.313 + sed 's/From: paul.boddie/From: harvey.horse/' event_spoofed.tmp \
2.314 +> event_spoofed_ready.tmp
2.315 +
2.316 +# Present the event to the recipient.
2.317 +
2.318 + "$PERSON_SCRIPT" $ARGS < "event_spoofed_ready.tmp" 2>> $ERROR \
2.319 | "$SHOWMAIL" \
2.320 > out8.tmp
2.321
2.322 +# Expect no reply because the recipient must handle the request.
2.323 +
2.324 ! grep -q 'METHOD:REPLY' out8.tmp \
2.325 && echo "Success" \
2.326 || echo "Failed"
2.327
2.328 +# Expect no free/busy periods for the recipient.
2.329 +
2.330 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.331 > out8f.tmp
2.332
2.333 - ! grep -q "spoof2@example.com" "out8f.tmp" \
2.334 + ! grep -q "$UID3" "out8f.tmp" \
2.335 && echo "Success" \
2.336 || echo "Failed"
2.337
2.338 +# Expect no free/busy periods for the sender at the recipient.
2.339 +
2.340 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
2.341 > out8fo.tmp
2.342
2.343 - ! grep -q "spoof2@example.com" "out8fo.tmp" \
2.344 + ! grep -q "$UID3" "out8fo.tmp" \
2.345 && echo "Success" \
2.346 || echo "Failed"