1.1 --- a/tests/common.sh Sat Jan 13 17:25:04 2018 +0100
1.2 +++ b/tests/common.sh Sat Jan 13 17:26:42 2018 +0100
1.3 @@ -38,6 +38,106 @@
1.4 PYTHONPATH="$BASE_DIR"
1.5 export PYTHONPATH
1.6
1.7 +
1.8 +
1.9 +# Helper functions.
1.10 +
1.11 +failed() {
1.12 + # [ <filename> ]
1.13 + echo -n "Failed"
1.14 + if [ "$1" ]; then
1.15 + echo ": $1"
1.16 + else
1.17 + echo
1.18 + fi
1.19 +}
1.20 +
1.21 +success() {
1.22 + echo "Success"
1.23 +}
1.24 +
1.25 +is_absent() {
1.26 + # <string> [ <filename> ]
1.27 + if [ "$2" ]; then
1.28 + ! grep -q "$1" "$2"
1.29 + else
1.30 + ! grep -q "$1"
1.31 + fi
1.32 +}
1.33 +
1.34 +is_present() {
1.35 + # <string> [ <filename> ]
1.36 + if [ "$2" ]; then
1.37 + grep -q "$1" "$2"
1.38 + else
1.39 + grep -q "$1"
1.40 + fi
1.41 +}
1.42 +
1.43 +list_script() {
1.44 + # <filename> <arg>...
1.45 + FILENAME=$1
1.46 + shift 1
1.47 + "$LIST_SCRIPT" $LIST_ARGS $* > "$FILENAME"
1.48 +}
1.49 +
1.50 +outgoing_script() {
1.51 + # [ <filename> ]
1.52 + if [ "$1" ]; then
1.53 + "$OUTGOING_SCRIPT" < "$1" $ARGS 2>> $ERROR
1.54 + else
1.55 + "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
1.56 + fi
1.57 +}
1.58 +
1.59 +person_script() {
1.60 + # <filename> <output filename> [ <raw output filename> ]
1.61 + OUTFILE="$3"
1.62 + "$PERSON_SCRIPT" $ARGS < "$1" 2>> $ERROR \
1.63 + | tee $OUTFILE \
1.64 + | "$SHOWMAIL" \
1.65 + > "$2"
1.66 +}
1.67 +
1.68 +showmail() {
1.69 + # <filename>
1.70 + "$SHOWMAIL" < "$1"
1.71 +}
1.72 +
1.73 +test_freebusy() {
1.74 + # <start> <end> <filename>
1.75 + is_present "^$1${TAB}$2" "$3" && success || failed "$3"
1.76 +}
1.77 +
1.78 +test_freebusy_missing() {
1.79 + # <start> <end> <filename>
1.80 + is_absent "^$1${TAB}$2" "$3" && success || failed "$3"
1.81 +}
1.82 +
1.83 +text_client() {
1.84 + # <user> <command filename> [ <event filename> ]
1.85 + LOG=`basename "$2" .tmp`_log.tmp
1.86 + if [ "$3" ]; then
1.87 + "$TEXT_CLIENT" $ARGS -u "$1" -f "$3" --echo < "$2" > "$LOG"
1.88 + else
1.89 + "$TEXT_CLIENT" $ARGS -u "$1" --echo < "$2" > "$LOG"
1.90 + fi
1.91 +}
1.92 +
1.93 +text_client_specific() {
1.94 + # <user> <command filename> <uid> [ <recurrence-id> ]
1.95 + LOG=`basename "$2" .tmp`_log.tmp
1.96 + if [ "$4" ]; then
1.97 + "$TEXT_CLIENT" $ARGS -u "$1" --uid "$3" --recurrence-id "$4" --echo < "$2" > "$LOG"
1.98 + else
1.99 + "$TEXT_CLIENT" $ARGS -u "$1" --uid "$3" --echo < "$2" > "$LOG"
1.100 + fi
1.101 +}
1.102 +
1.103 +
1.104 +
1.105 +# Test environment initialisation.
1.106 +
1.107 if [ "$STORE_TYPE" = "file" ]; then
1.108 rm -rf "$STORE"
1.109 rm -rf "$JOURNAL"
2.1 --- a/tests/test_person_invitation.sh Sat Jan 13 17:25:04 2018 +0100
2.2 +++ b/tests/test_person_invitation.sh Sat Jan 13 17:26:42 2018 +0100
2.3 @@ -11,33 +11,27 @@
2.4
2.5 # Present a free/busy request for all periods to the recipient.
2.6
2.7 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \
2.8 -| "$SHOWMAIL" \
2.9 -> out0.tmp
2.10 +person_script "$TEMPLATES/fb-request-person-all.txt" "out0.tmp"
2.11
2.12 # Expect a reply with no periods.
2.13
2.14 - grep -q 'METHOD:REPLY' out0.tmp \
2.15 -&& ! grep -q '^FREEBUSY' out0.tmp \
2.16 -&& echo "Success" \
2.17 -|| echo "Failed"
2.18 + is_present 'METHOD:REPLY' "out0.tmp" \
2.19 +&& is_absent '^FREEBUSY' "out0.tmp" \
2.20 +&& success || failed "out0.tmp"
2.21
2.22 # Present a free/busy request for periods of interest to the recipient.
2.23
2.24 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person.txt" 2>> $ERROR \
2.25 -| "$SHOWMAIL" \
2.26 -> out1.tmp
2.27 +person_script "$TEMPLATES/fb-request-person.txt" "out1.tmp"
2.28
2.29 # Expect a reply with no periods.
2.30
2.31 - grep -q 'METHOD:REPLY' out1.tmp \
2.32 -&& ! grep -q '^FREEBUSY' out1.tmp \
2.33 -&& echo "Success" \
2.34 -|| echo "Failed"
2.35 + is_present 'METHOD:REPLY' "out1.tmp" \
2.36 +&& is_absent '^FREEBUSY' "out1.tmp" \
2.37 +&& success || failed "out1.tmp"
2.38
2.39 # Make a new event.
2.40
2.41 - cat > event_cmd.tmp <<EOF
2.42 +cat > "event_cmd.tmp" <<EOF
2.43 new
2.44 period 0 edit 20141126 16 00 00 Europe/Oslo 20141126 17 00 00 Europe/Oslo
2.45 attendance accept
2.46 @@ -49,279 +43,194 @@
2.47 UID event_uid.tmp
2.48 EOF
2.49
2.50 - "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo \
2.51 -< event_cmd.tmp \
2.52 -> event_log.tmp
2.53 +text_client "$SENDER" "event_cmd.tmp"
2.54
2.55 # Obtain the event UID.
2.56
2.57 - read UID1 < event_uid.tmp
2.58 +read UID1 < "event_uid.tmp"
2.59
2.60 # Register the event at the sender.
2.61
2.62 - "$OUTGOING_SCRIPT" < event.tmp $ARGS 2>> $ERROR
2.63 +outgoing_script "event_self.tmp"
2.64
2.65 # Present the event to the recipient.
2.66
2.67 - "$PERSON_SCRIPT" $ARGS < event.tmp 2>> $ERROR \
2.68 -| "$SHOWMAIL" \
2.69 -> out2.tmp
2.70 +person_script "event.tmp" "out2.tmp"
2.71
2.72 # Expect no reply because the recipient must handle the request.
2.73
2.74 - ! grep -q 'METHOD:REPLY' out2.tmp \
2.75 -&& echo "Success" \
2.76 -|| echo "Failed"
2.77 +is_absent 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp"
2.78
2.79 # Expect no free/busy periods for the recipient.
2.80
2.81 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.82 -> out2f.tmp
2.83 -
2.84 - ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" out2f.tmp \
2.85 -&& echo "Success" \
2.86 -|| echo "Failed"
2.87 +list_script "out2f.tmp" "$USER" "freebusy"
2.88 +test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out2f.tmp"
2.89
2.90 # Expect free/busy periods for the sender at the recipient.
2.91
2.92 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
2.93 -> out2fo.tmp
2.94 -
2.95 - grep -q "^20141126T150000Z${TAB}20141126T160000Z" out2fo.tmp \
2.96 -&& echo "Success" \
2.97 -|| echo "Failed"
2.98 +list_script "out2fo.tmp" "$USER" "freebusy_other" "$SENDER"
2.99 +test_freebusy '20141126T150000Z' '20141126T160000Z' "out2fo.tmp"
2.100
2.101 # Accept the invitation.
2.102
2.103 - cat > event_accept_cmd.tmp <<EOF
2.104 -0
2.105 +cat > "event_accept_cmd.tmp" <<EOF
2.106 attendance accept
2.107 finish
2.108 update event_accept.tmp
2.109 EOF
2.110
2.111 - "$TEXT_CLIENT" $ARGS -u "$USER" -f event.tmp --echo \
2.112 -< event_accept_cmd.tmp \
2.113 -> event_accept_log.tmp
2.114 +text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1"
2.115
2.116 # Register the acceptance at the recipient.
2.117
2.118 - "$OUTGOING_SCRIPT" < event_accept.tmp $ARGS 2>> $ERROR
2.119 +outgoing_script "event_accept.tmp"
2.120
2.121 # Expect free/busy periods at the recipient.
2.122
2.123 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.124 -> out3f.tmp
2.125 -
2.126 - grep -q "^20141126T150000Z${TAB}20141126T160000Z" out3f.tmp \
2.127 -&& echo "Success" \
2.128 -|| echo "Failed"
2.129 +list_script "out3f.tmp" "$USER" "freebusy"
2.130 +test_freebusy '20141126T150000Z' '20141126T160000Z' "out3f.tmp"
2.131
2.132 # Make another event at the same time.
2.133
2.134 - sed \
2.135 +sed \
2.136 's/summary Meeting at 4pm/summary A conflicting meeting at 4pm/;'\
2.137 's/update event.tmp/update event_conflicting.tmp/;'\
2.138 -'s/UID event_uid.tmp/UID event_conflicting_uid.tmp/' event_cmd.tmp \
2.139 -> event_conflicting_cmd.tmp
2.140 +'s/UID event_uid.tmp/UID event_conflicting_uid.tmp/' "event_cmd.tmp" \
2.141 +> "event_conflicting_cmd.tmp"
2.142
2.143 - "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo \
2.144 -< event_conflicting_cmd.tmp \
2.145 -> event_conflicting_log.tmp
2.146 +text_client "$SENDER" "event_conflicting_cmd.tmp"
2.147
2.148 # Obtain the event UID.
2.149
2.150 - read UID2 < event_conflicting_uid.tmp
2.151 +read UID2 < "event_conflicting_uid.tmp"
2.152
2.153 # Present the event to the recipient.
2.154
2.155 - "$PERSON_SCRIPT" $ARGS < event_conflicting.tmp 2>> $ERROR \
2.156 -| "$SHOWMAIL" \
2.157 -> out4.tmp
2.158 +person_script "event_conflicting.tmp" "out4.tmp"
2.159
2.160 # Expect no reply because the recipient must handle the request.
2.161
2.162 - ! grep -q 'METHOD:REPLY' out4.tmp \
2.163 -&& echo "Success" \
2.164 -|| echo "Failed"
2.165 +is_absent 'METHOD:REPLY' "out4.tmp" && success || failed "out4.tmp"
2.166
2.167 # Expect no free/busy periods for the recipient for this event.
2.168
2.169 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.170 -> out4f.tmp
2.171 -
2.172 - ! grep -q "$UID2" out4f.tmp \
2.173 -&& echo "Success" \
2.174 -|| echo "Failed"
2.175 +list_script "out4f.tmp" "$USER" "freebusy"
2.176 +is_absent "$UID2" "out4f.tmp" && success || failed "out4f.tmp"
2.177
2.178 # Expect free/busy periods for the sender at the recipient for this event.
2.179
2.180 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
2.181 -> out4fo.tmp
2.182 -
2.183 - grep -q "$UID2" out4fo.tmp \
2.184 -&& echo "Success" \
2.185 -|| echo "Failed"
2.186 +list_script "out4fo.tmp" "$USER" "freebusy_other" "$SENDER"
2.187 +is_present "$UID2" "out4fo.tmp" && success || failed "out4fo.tmp"
2.188
2.189 # Decline the invitation.
2.190
2.191 - cat > event_decline_cmd.tmp <<EOF
2.192 -0
2.193 +cat > "event_decline_cmd.tmp" <<EOF
2.194 attendance decline
2.195 finish
2.196 update event_decline.tmp
2.197 EOF
2.198
2.199 - "$TEXT_CLIENT" $ARGS -u "$USER" -f event_conflicting.tmp --echo \
2.200 -< event_decline_cmd.tmp \
2.201 -> event_decline_log.tmp
2.202 +text_client_specific "$USER" "event_decline_cmd.tmp" "$UID2"
2.203
2.204 # Register the rejection at the recipient.
2.205
2.206 - "$OUTGOING_SCRIPT" < event_decline.tmp $ARGS 2>> $ERROR
2.207 +outgoing_script "event_decline.tmp"
2.208
2.209 # Expect free/busy periods only for the original event, not the last one.
2.210
2.211 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.212 -> out5f.tmp
2.213 -
2.214 - grep -q "$UID1" out5f.tmp \
2.215 -&& ! grep -q "$UID2" out5f.tmp \
2.216 -&& echo "Success" \
2.217 -|| echo "Failed"
2.218 + list_script "out5f.tmp" "$USER" "freebusy"
2.219 + is_present "$UID1" "out5f.tmp" \
2.220 +&& is_absent "$UID2" "out5f.tmp" \
2.221 +&& success || failed "out5f.tmp"
2.222
2.223 # Cancel the event for a recipient.
2.224
2.225 - cat > event_cancel_cmd.tmp <<EOF
2.226 -0
2.227 +cat > "event_cancel_cmd.tmp" <<EOF
2.228 attendee mailto:vincent.vole@example.com remove
2.229 finish
2.230 cancel event_cancel.tmp
2.231 EOF
2.232
2.233 - "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo -f event.tmp \
2.234 -< event_cancel_cmd.tmp \
2.235 -> event_cancel_log.tmp
2.236 +text_client_specific "$SENDER" "event_cancel_cmd.tmp" "$UID1"
2.237
2.238 # Present the cancellation to the recipient.
2.239
2.240 - "$PERSON_SCRIPT" $ARGS < event_cancel.tmp 2>> $ERROR \
2.241 -| "$SHOWMAIL" \
2.242 -> out6.tmp
2.243 +person_script "event_cancel.tmp" "out6.tmp"
2.244
2.245 # Expect no reply because the recipient must handle the request.
2.246
2.247 - ! grep -q 'METHOD:REPLY' out6.tmp \
2.248 -&& echo "Success" \
2.249 -|| echo "Failed"
2.250 +is_absent 'METHOD:REPLY' "out6.tmp" && success || failed "out6.tmp"
2.251
2.252 # Expect no free/busy periods for the recipient.
2.253
2.254 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.255 -> out6f.tmp
2.256 -
2.257 - ! grep -q "$UID1" out6f.tmp \
2.258 -&& echo "Success" \
2.259 -|| echo "Failed"
2.260 +list_script "out6f.tmp" "$USER" "freebusy"
2.261 +is_absent "$UID1" "out6f.tmp" && success || failed "out6f.tmp"
2.262
2.263 # Expect free/busy periods for the sender at the recipient for this event since
2.264 # only the recipient was uninvited.
2.265
2.266 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
2.267 -> out6fo.tmp
2.268 -
2.269 - grep -q "$UID1" out6fo.tmp \
2.270 -&& echo "Success" \
2.271 -|| echo "Failed"
2.272 +list_script "out6fo.tmp" "$USER" "freebusy_other" "$SENDER"
2.273 +is_present "$UID1" "out6fo.tmp" && success || failed "out6fo.tmp"
2.274
2.275 # Cancel the event for all recipients.
2.276
2.277 - cat > event_cancel_all_cmd.tmp <<EOF
2.278 -0
2.279 +cat > "event_cancel_all_cmd.tmp" <<EOF
2.280 finish
2.281 cancel event_cancel_all.tmp
2.282 EOF
2.283
2.284 - "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo -f event.tmp \
2.285 -< event_cancel_all_cmd.tmp \
2.286 -> event_cancel_all_log.tmp
2.287 +text_client_specific "$SENDER" "event_cancel_all_cmd.tmp" "$UID1"
2.288
2.289 # Present the cancellation to the recipient.
2.290
2.291 - "$PERSON_SCRIPT" $ARGS < "event_cancel_all.tmp" 2>> $ERROR \
2.292 -| "$SHOWMAIL" \
2.293 -> out7.tmp
2.294 +person_script "event_cancel_all.tmp" "out7.tmp"
2.295
2.296 # Expect no reply because the recipient must handle the request.
2.297
2.298 - ! grep -q 'METHOD:REPLY' out7.tmp \
2.299 -&& echo "Success" \
2.300 -|| echo "Failed"
2.301 +is_absent 'METHOD:REPLY' "out7.tmp" && success || failed "out7.tmp"
2.302
2.303 # Expect no free/busy periods for the recipient.
2.304
2.305 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.306 -> out7f.tmp
2.307 -
2.308 - ! grep -q "$UID1" "out7f.tmp" \
2.309 -&& echo "Success" \
2.310 -|| echo "Failed"
2.311 +list_script "out7f.tmp" "$USER" "freebusy"
2.312 +is_absent "$UID1" "out7f.tmp" && success || failed "out7f.tmp"
2.313
2.314 # Expect no free/busy periods for the sender at the recipient for this event.
2.315
2.316 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
2.317 -> out7fo.tmp
2.318 -
2.319 - ! grep -q "$UID1" "out7fo.tmp" \
2.320 -&& echo "Success" \
2.321 -|| echo "Failed"
2.322 +list_script "out7fo.tmp" "$USER" "freebusy_other" "$SENDER"
2.323 +is_absent "$UID1" "out7fo.tmp" && success || failed "out7fo.tmp"
2.324
2.325 # Create a message from another sender that is largely a copy of the original
2.326 # event trying to organise the event using someone else's identity.
2.327
2.328 - sed \
2.329 +sed \
2.330 's/summary Meeting at 4pm/summary A spoofed meeting at 4pm/;'\
2.331 's/update event.tmp/update event_spoofed.tmp/;'\
2.332 -'s/UID event_uid.tmp/UID event_spoofed_uid.tmp/' event_cmd.tmp \
2.333 -> event_spoofed_cmd.tmp
2.334 +'s/UID event_uid.tmp/UID event_spoofed_uid.tmp/' "event_cmd.tmp" \
2.335 +> "event_spoofed_cmd.tmp"
2.336
2.337 - "$TEXT_CLIENT" $ARGS -u "$SENDER" --echo \
2.338 -< event_spoofed_cmd.tmp \
2.339 -> event_spoofed_log.tmp
2.340 +text_client "$SENDER" "event_spoofed_cmd.tmp"
2.341
2.342 # Obtain the event UID.
2.343
2.344 - read UID3 < event_spoofed_uid.tmp
2.345 +read UID3 < "event_spoofed_uid.tmp"
2.346
2.347 - sed 's/From: paul.boddie/From: harvey.horse/' event_spoofed.tmp \
2.348 -> event_spoofed_ready.tmp
2.349 +sed 's/From: paul.boddie/From: harvey.horse/' "event_spoofed.tmp" \
2.350 +> "event_spoofed_ready.tmp"
2.351
2.352 # Present the event to the recipient.
2.353
2.354 - "$PERSON_SCRIPT" $ARGS < "event_spoofed_ready.tmp" 2>> $ERROR \
2.355 -| "$SHOWMAIL" \
2.356 -> out8.tmp
2.357 +person_script "event_spoofed_ready.tmp" "out8.tmp"
2.358
2.359 # Expect no reply because the recipient must handle the request.
2.360
2.361 - ! grep -q 'METHOD:REPLY' out8.tmp \
2.362 -&& echo "Success" \
2.363 -|| echo "Failed"
2.364 +is_absent 'METHOD:REPLY' "out8.tmp" && success || failed "out8.tmp"
2.365
2.366 # Expect no free/busy periods for the recipient.
2.367
2.368 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
2.369 -> out8f.tmp
2.370 -
2.371 - ! grep -q "$UID3" "out8f.tmp" \
2.372 -&& echo "Success" \
2.373 -|| echo "Failed"
2.374 +list_script "out8f.tmp" "$USER" "freebusy"
2.375 +is_absent "$UID3" "out8f.tmp" && success || failed "out8f.tmp"
2.376
2.377 # Expect no free/busy periods for the sender at the recipient.
2.378
2.379 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
2.380 -> out8fo.tmp
2.381 -
2.382 - ! grep -q "$UID3" "out8fo.tmp" \
2.383 -&& echo "Success" \
2.384 -|| echo "Failed"
2.385 +list_script "out8fo.tmp" "$USER" "freebusy_other" "$SENDER"
2.386 +is_absent "$UID3" "out8fo.tmp" && success || failed "out8fo.tmp"
3.1 --- a/tests/test_person_invitation_add.sh Sat Jan 13 17:25:04 2018 +0100
3.2 +++ b/tests/test_person_invitation_add.sh Sat Jan 13 17:26:42 2018 +0100
3.3 @@ -13,168 +13,183 @@
3.4 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
3.5 echo 'always' > "$PREFS/$SENDER/event_refreshing"
3.6
3.7 -# Test event request registration in the outgoing handler.
3.8 -
3.9 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR
3.10 -
3.11 - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
3.12 -> out1f.tmp
3.13 -
3.14 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out1f.tmp" \
3.15 -&& echo "Success" \
3.16 -|| echo "Failed"
3.17 -
3.18 -# Present the request to the recipient.
3.19 -
3.20 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR \
3.21 -| "$SHOWMAIL" \
3.22 -> out2.tmp
3.23 -
3.24 - ! grep -q 'METHOD:REPLY' out2.tmp \
3.25 -&& echo "Success" \
3.26 -|| echo "Failed"
3.27 -
3.28 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
3.29 -> out2f.tmp
3.30 -
3.31 - ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out2f.tmp" \
3.32 -&& echo "Success" \
3.33 -|| echo "Failed"
3.34 -
3.35 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
3.36 -> out2fo.tmp
3.37 -
3.38 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out2fo.tmp" \
3.39 -&& echo "Success" \
3.40 -|| echo "Failed"
3.41 -
3.42 -# Test acceptance and registration in the outgoing handler.
3.43 +# Make a new event.
3.44
3.45 - "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \
3.46 -| tee out3.tmp \
3.47 -| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
3.48 -
3.49 - "$SHOWMAIL" < out3.tmp | grep -q 'METHOD:REPLY' \
3.50 -&& echo "Success" \
3.51 -|| echo "Failed"
3.52 -
3.53 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
3.54 -> out3f.tmp
3.55 -
3.56 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out3f.tmp" \
3.57 -&& echo "Success" \
3.58 -|| echo "Failed"
3.59 -
3.60 -# Present the result to the recipient.
3.61 +cat > "event_cmd.tmp" <<EOF
3.62 +new
3.63 +period 0 edit 20141010 10 00 00 Europe/Oslo 20141010 11 00 00 Europe/Oslo
3.64 +rrule
3.65 +freq monthly 1
3.66 +selection weekday FR 2 end
3.67 +count 3
3.68 +end
3.69 +attendance accept
3.70 +attendee mailto:vincent.vole@example.com
3.71 +summary Recurring event
3.72 +finish
3.73 +update event.tmp
3.74 +publish event_self.tmp
3.75 +UID event_uid.tmp
3.76 +EOF
3.77
3.78 - "$PERSON_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \
3.79 -| "$SHOWMAIL" \
3.80 -> out4.tmp
3.81 +text_client "$SENDER" "event_cmd.tmp"
3.82
3.83 - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER" \
3.84 -> out4fo.tmp
3.85 +# Obtain the event UID.
3.86
3.87 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out4fo.tmp" \
3.88 -&& echo "Success" \
3.89 -|| echo "Failed"
3.90 +read UID1 < "event_uid.tmp"
3.91
3.92 -# Attempt to add an occurrence to the event.
3.93 +# Register the event at the sender.
3.94
3.95 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring.txt" 2>> $ERROR
3.96 +outgoing_script "event_self.tmp"
3.97
3.98 - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
3.99 -> out4f.tmp
3.100 +# Expect free/busy periods for the sender.
3.101
3.102 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out4f.tmp" \
3.103 -&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out4f.tmp" \
3.104 -&& echo "Success" \
3.105 -|| echo "Failed"
3.106 +list_script "out1f.tmp" "$SENDER" "freebusy"
3.107 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out1f.tmp"
3.108
3.109 # Present the request to the recipient.
3.110
3.111 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring.txt" 2>> $ERROR \
3.112 -| "$SHOWMAIL" \
3.113 -> out5.tmp
3.114 +person_script "event.tmp" "out2.tmp"
3.115 +
3.116 +# Expect no reply because the recipient must handle the request.
3.117 +
3.118 +is_absent 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp"
3.119 +
3.120 +# Expect no free/busy periods for the recipient.
3.121
3.122 - grep -q 'METHOD:REFRESH' out5.tmp \
3.123 -&& echo "Success" \
3.124 -|| echo "Failed"
3.125 +list_script "out2f.tmp" "$USER" "freebusy"
3.126 +test_freebusy_missing '20141212T090000Z' '20141212T100000Z' "out2f.tmp"
3.127 +
3.128 +# Expect free/busy periods for the sender at the recipient.
3.129 +
3.130 +list_script "out2fo.tmp" "$USER" "freebusy_other" "$SENDER"
3.131 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out2fo.tmp"
3.132
3.133 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
3.134 -> out5f.tmp
3.135 +# Accept the invitation.
3.136 +
3.137 +cat > "event_accept_cmd.tmp" <<EOF
3.138 +attendance accept
3.139 +finish
3.140 +update event_accept.tmp
3.141 +EOF
3.142
3.143 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out5f.tmp" \
3.144 -&& ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out5f.tmp" \
3.145 -&& echo "Success" \
3.146 -|| echo "Failed"
3.147 +text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1"
3.148 +
3.149 +# Register the acceptance at the recipient.
3.150 +
3.151 +outgoing_script "event_accept.tmp"
3.152 +
3.153 +# Test the nature of the acceptance message.
3.154
3.155 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
3.156 -> out5fo.tmp
3.157 + showmail "event_accept.tmp" | is_present 'METHOD:REPLY' \
3.158 +&& success || failed "event_accept.tmp"
3.159 +
3.160 +# Expect free/busy periods at the recipient.
3.161 +
3.162 +list_script "out3f.tmp" "$USER" "freebusy"
3.163 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out3f.tmp"
3.164
3.165 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out5fo.tmp" \
3.166 -&& ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out5fo.tmp" \
3.167 -&& echo "Success" \
3.168 -|| echo "Failed"
3.169 +# Present the result to the sender.
3.170 +
3.171 +person_script "event_accept.tmp" "out4.tmp"
3.172 +
3.173 +# Expect free/busy periods at the sender for the recipient.
3.174 +
3.175 +list_script "out4fo.tmp" "$SENDER" "freebusy_other" "$USER"
3.176 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out4fo.tmp"
3.177
3.178 -# Present the refresh message to the organiser.
3.179 +# Attempt to add an occurrence to the event.
3.180 +
3.181 +cat > "event_cmd2.tmp" <<EOF
3.182 +period new 20150109 10 00 00 Europe/Oslo 20150109 11 00 00 Europe/Oslo
3.183 +finish
3.184 +update event_add.tmp
3.185 +EOF
3.186 +
3.187 +text_client_specific "$SENDER" "event_cmd2.tmp" "$UID1"
3.188
3.189 - "$PERSON_SCRIPT" $ARGS < out5.tmp 2>> $ERROR \
3.190 -| tee out6r.tmp \
3.191 -| "$SHOWMAIL" \
3.192 -> out6.tmp
3.193 +# Register the new occurrence at the sender.
3.194 +
3.195 +outgoing_script "event_add.tmp"
3.196
3.197 - grep -q 'METHOD:REQUEST' out6.tmp \
3.198 -&& echo "Success" \
3.199 -|| echo "Failed"
3.200 +# Expect free/busy periods for the event at the sender.
3.201 +
3.202 +list_script "out4f.tmp" "$SENDER" "freebusy"
3.203 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out4f.tmp"
3.204 +test_freebusy '20150109T090000Z' '20150109T100000Z' "out4f.tmp"
3.205
3.206 # Present the request to the recipient.
3.207
3.208 - "$PERSON_SCRIPT" $ARGS < out6r.tmp 2>> $ERROR \
3.209 -| "$SHOWMAIL" \
3.210 -> out7.tmp
3.211 +person_script "event_add.tmp" "out5.tmp"
3.212 +
3.213 +# Expect a response demanding a refreshed event.
3.214 +
3.215 +is_present 'METHOD:REFRESH' "out5.tmp" && success || failed "out5.tmp"
3.216 +
3.217 +# Expect no new free/busy period for the event at the recipient.
3.218
3.219 - ! grep -q 'METHOD:REPLY' out7.tmp \
3.220 -&& echo "Success" \
3.221 -|| echo "Failed"
3.222 +list_script "out5f.tmp" "$USER" "freebusy"
3.223 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out5f.tmp"
3.224 +test_freebusy_missing '20150109T090000Z' '20150109T100000Z' "out5f.tmp"
3.225
3.226 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
3.227 -> out7f.tmp
3.228 +list_script "out5fo.tmp" "$USER" "freebusy_other" "$SENDER"
3.229 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out5fo.tmp"
3.230 +test_freebusy_missing '20150109T090000Z' '20150109T100000Z' "out5fo.tmp"
3.231 +
3.232 +# Present the refresh message to the organiser.
3.233 +
3.234 +person_script "out5.tmp" "out6.tmp" "out6r.tmp"
3.235 +
3.236 +# Expect a new event request from the organiser.
3.237
3.238 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out7f.tmp" \
3.239 -&& ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out7f.tmp" \
3.240 -&& echo "Success" \
3.241 -|| echo "Failed"
3.242 +is_present 'METHOD:REQUEST' "out6.tmp" && success || failed "out6.tmp"
3.243 +
3.244 +# Present the request to the recipient.
3.245 +
3.246 +person_script "out6r.tmp" "out7.tmp"
3.247 +
3.248 +# Expect no reply because the recipient must handle the request.
3.249 +
3.250 +is_absent 'METHOD:REPLY' "out7.tmp" && success || failed "out7.tmp"
3.251
3.252 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
3.253 -> out7fo.tmp
3.254 +# Expect no new free/busy period for the event at the recipient.
3.255 +
3.256 +list_script "out7f.tmp" "$USER" "freebusy"
3.257 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out7f.tmp"
3.258 +test_freebusy_missing '20150109T090000Z' '20150109T100000Z' "out7f.tmp"
3.259
3.260 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out7fo.tmp" \
3.261 -&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out7fo.tmp" \
3.262 -&& echo "Success" \
3.263 -|| echo "Failed"
3.264 +# Expect the new free/busy period for the sender at the recipient.
3.265 +
3.266 +list_script "out7fo.tmp" "$USER" "freebusy_other" "$SENDER"
3.267 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out7fo.tmp"
3.268 +test_freebusy '20150109T090000Z' '20150109T100000Z' "out7fo.tmp"
3.269
3.270 # Test acceptance and registration in the outgoing handler.
3.271
3.272 - "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \
3.273 -| tee out8.tmp \
3.274 -| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
3.275 +text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1"
3.276 +outgoing_script "event_accept.tmp"
3.277 +
3.278 +# Accept the invitation.
3.279
3.280 - "$SHOWMAIL" < out8.tmp | grep -q 'METHOD:REPLY' \
3.281 -&& echo "Success" \
3.282 -|| echo "Failed"
3.283 +cat > "event_accept_cmd2.tmp" <<EOF
3.284 +attendance accept
3.285 +finish
3.286 +update event_accept2.tmp
3.287 +EOF
3.288
3.289 - "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" "20150109T090000Z" 2>> $ERROR \
3.290 -| tee out9.tmp \
3.291 -| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
3.292 +text_client_specific "$USER" "event_accept_cmd2.tmp" "$UID1" '20150109T090000Z'
3.293
3.294 - "$SHOWMAIL" < out9.tmp | grep -q 'METHOD:REPLY' \
3.295 -&& echo "Success" \
3.296 -|| echo "Failed"
3.297 +# Register the acceptance at the recipient.
3.298 +
3.299 +outgoing_script "event_accept2.tmp"
3.300 +
3.301 +# Test the nature of the acceptance message.
3.302
3.303 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
3.304 -> out9f.tmp
3.305 + showmail "event_accept2.tmp" | is_present 'METHOD:REPLY' \
3.306 +&& success || failed "event_accept2.tmp"
3.307
3.308 - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out9f.tmp" \
3.309 -&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out9f.tmp" \
3.310 -&& echo "Success" \
3.311 -|| echo "Failed"
3.312 +# Expect the new free/busy period at the recipient.
3.313 +
3.314 +list_script "out9f.tmp" "$USER" "freebusy"
3.315 +test_freebusy '20141212T090000Z' '20141212T100000Z' "out9f.tmp"
3.316 +test_freebusy '20150109T090000Z' '20150109T100000Z' "out9f.tmp"
4.1 --- a/tests/test_person_invitation_counter.sh Sat Jan 13 17:25:04 2018 +0100
4.2 +++ b/tests/test_person_invitation_counter.sh Sat Jan 13 17:26:42 2018 +0100
4.3 @@ -4,189 +4,174 @@
4.4
4.5 USER="mailto:vincent.vole@example.com"
4.6 SENDER="mailto:paul.boddie@example.com"
4.7 +USERADDRESS="vincent.vole@example.com"
4.8 +SENDERADDRESS="paul.boddie@example.com"
4.9
4.10 mkdir -p "$PREFS/$USER"
4.11 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
4.12 echo 'share' > "$PREFS/$USER/freebusy_sharing"
4.13 echo 'PT60S' > "$PREFS/$USER/freebusy_offers"
4.14
4.15 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \
4.16 -| "$SHOWMAIL" \
4.17 -> out0.tmp
4.18 +person_script "$TEMPLATES/fb-request-person-all.txt" "out0.tmp"
4.19
4.20 - grep -q 'METHOD:REPLY' out0.tmp \
4.21 -&& ! grep -q '^FREEBUSY' out0.tmp \
4.22 -&& echo "Success" \
4.23 -|| echo "Failed"
4.24 + is_present 'METHOD:REPLY' "out0.tmp" \
4.25 +&& is_absent '^FREEBUSY' "out0.tmp" \
4.26 +&& success || failed "out0.tmp"
4.27 +
4.28 +# Make a new event.
4.29
4.30 -# Attempt to schedule an event.
4.31 -
4.32 -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR
4.33 +cat > "event_cmd.tmp" <<EOF
4.34 +new
4.35 +period 0 edit 20141126 16 00 00 Europe/Oslo 20141126 17 00 00 Europe/Oslo
4.36 +attendance accept
4.37 +attendee mailto:vincent.vole@example.com
4.38 +summary Meeting at 4pm
4.39 +finish
4.40 +update event.tmp
4.41 +publish event_self.tmp
4.42 +UID event_uid.tmp
4.43 +EOF
4.44
4.45 - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
4.46 -> out0f.tmp
4.47 +text_client "$SENDER" "event_cmd.tmp"
4.48 +
4.49 +# Obtain the event UID.
4.50 +
4.51 +read UID1 < "event_uid.tmp"
4.52
4.53 - grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out0f.tmp" \
4.54 -&& echo "Success" \
4.55 -|| echo "Failed"
4.56 +# Register the event at the sender.
4.57 +
4.58 +outgoing_script "event.tmp"
4.59 +
4.60 +# Expect free/busy periods at the sender.
4.61 +
4.62 +list_script "out0f.tmp" "$SENDER" "freebusy"
4.63 +test_freebusy '20141126T150000Z' '20141126T160000Z' "out0f.tmp"
4.64
4.65 # Present the request to the recipient.
4.66
4.67 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR \
4.68 -| "$SHOWMAIL" \
4.69 -> out1.tmp
4.70 +person_script "event.tmp" "out1.tmp"
4.71 +
4.72 +# Expect no reply because the recipient must handle the request.
4.73
4.74 - ! grep -q 'METHOD:REPLY' out1.tmp \
4.75 -&& echo "Success" \
4.76 -|| echo "Failed"
4.77 +is_absent 'METHOD:REPLY' "out1.tmp" && success || failed "out1.tmp"
4.78 +
4.79 +# Expect no free/busy periods for the recipient.
4.80
4.81 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
4.82 -> out1f.tmp
4.83 +list_script "out1f.tmp" "$USER" "freebusy"
4.84 +test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out1f.tmp"
4.85
4.86 - ! grep -q "event6@example.com" "out1f.tmp" \
4.87 -&& echo "Success" \
4.88 -|| echo "Failed"
4.89 +# Expect free/busy periods for the sender at the recipient.
4.90
4.91 - ! [ -e "$FBOTHERFILE" ] \
4.92 -|| ! grep -q "event6@example.com" "$FBOTHERFILE" \
4.93 -&& echo "Success" \
4.94 -|| echo "Failed"
4.95 +list_script "out1fo.tmp" "$USER" "freebusy_other" "$SENDER"
4.96 +test_freebusy '20141126T150000Z' '20141126T160000Z' "out1fo.tmp"
4.97
4.98 # Counter the invitation.
4.99
4.100 - "$COUNTER_SCRIPT" $COUNTER_ARGS "$USER" 20141126T170000 20141126T180000 "event6@example.com" 2>> $ERROR \
4.101 -| tee out2r.tmp \
4.102 -| "$SHOWMAIL" \
4.103 -> out2.tmp
4.104 +cat > "event_counter_cmd.tmp" <<EOF
4.105 +period 0 edit 20141126 17 00 00 Europe/Oslo 20141126 18 00 00 Europe/Oslo
4.106 +finish
4.107 +update event_counter.tmp
4.108 +EOF
4.109 +
4.110 +text_client_specific "$USER" "event_counter_cmd.tmp" "$UID1"
4.111 +
4.112 +# Expect a counter-proposal from the client.
4.113 +
4.114 + showmail "event_counter.tmp" | is_present 'METHOD:COUNTER' \
4.115 +&& success || failed "event_counter.tmp"
4.116
4.117 # Note that the invitation has only been prepared, not processed.
4.118
4.119 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
4.120 -> out2f.tmp
4.121 -
4.122 - ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out2f.tmp" \
4.123 -&& ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out2f.tmp" \
4.124 -&& echo "Success" \
4.125 -|| echo "Failed"
4.126 +list_script "out2f.tmp" "$USER" "freebusy"
4.127 +test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out2f.tmp"
4.128 +test_freebusy_missing '20141126T160000Z' '20141126T170000Z' "out2f.tmp"
4.129
4.130 - grep -q 'METHOD:COUNTER' out2.tmp \
4.131 -&& grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T170000' out2.tmp \
4.132 -&& echo "Success" \
4.133 -|| echo "Failed"
4.134 -
4.135 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \
4.136 -> out2o.tmp
4.137 -
4.138 - ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out2o.tmp" \
4.139 -&& echo "Success" \
4.140 -|| echo "Failed"
4.141 +list_script "out2fo.tmp" "$USER" "freebusy_offers"
4.142 +test_freebusy_missing '20141126T160000Z' '20141126T170000Z' "out2fo.tmp"
4.143
4.144 # Send the counter-proposal.
4.145
4.146 -"$OUTGOING_SCRIPT" $ARGS < out2r.tmp 2>> $ERROR
4.147 +outgoing_script "event_counter.tmp"
4.148
4.149 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
4.150 -> out2f2.tmp
4.151 +# Expect no free/busy periods for the recipient.
4.152
4.153 - ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out2f2.tmp" \
4.154 -&& ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out2f2.tmp" \
4.155 -&& echo "Success" \
4.156 -|| echo "Failed"
4.157 +list_script "out2f2.tmp" "$USER" "freebusy"
4.158 +test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out2f2.tmp"
4.159 +test_freebusy_missing '20141126T160000Z' '20141126T170000Z' "out2f2.tmp"
4.160
4.161 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \
4.162 -> out2o2.tmp
4.163 +# Expect a free/busy offer period.
4.164
4.165 - grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out2o2.tmp" \
4.166 -&& echo "Success" \
4.167 -|| echo "Failed"
4.168 +list_script "out2o2.tmp" "$USER" "freebusy_offers"
4.169 +test_freebusy '20141126T160000Z' '20141126T170000Z' "out2o2.tmp"
4.170
4.171 # Present the response to the organiser.
4.172
4.173 - "$PERSON_SCRIPT" $ARGS < out2r.tmp 2>> $ERROR \
4.174 -| tee out3r.tmp \
4.175 -| "$SHOWMAIL" \
4.176 -> out3.tmp
4.177 +person_script "event_counter.tmp" "out3.tmp"
4.178
4.179 - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER" \
4.180 -> out3f.tmp
4.181 +# Expect no free/busy periods for the recipient at the sender.
4.182
4.183 - ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out3f.tmp" \
4.184 -&& ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out3f.tmp" \
4.185 -&& echo "Success" \
4.186 -|| echo "Failed"
4.187 +list_script "out3f.tmp" "$SENDER" "freebusy_other" "$USER"
4.188 +test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out3f.tmp"
4.189 +test_freebusy_missing '20141126T160000Z' '20141126T170000Z' "out3f.tmp"
4.190
4.191 - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event6@example.com" \
4.192 -> out3O.tmp
4.193 +# Expect the original object at the sender.
4.194
4.195 - grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T160000' "out3O.tmp" \
4.196 -&& echo "Success" \
4.197 -|| echo "Failed"
4.198 +list_script "out3O.tmp" "$SENDER" "object" "$UID1"
4.199 + is_present 'DTSTART;TZID=Europe/Oslo.*:20141126T160000' "out3O.tmp" \
4.200 +&& success || failed "out3O.tmp"
4.201
4.202 - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "countered_object" "event6@example.com" "$USER" \
4.203 -> out3C.tmp
4.204 +# Expect the countered object at the sender.
4.205
4.206 - grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T170000' "out3C.tmp" \
4.207 -&& echo "Success" \
4.208 -|| echo "Failed"
4.209 +list_script "out3C.tmp" "$SENDER" "countered_object" "$UID1" "$USER"
4.210 + is_present 'DTSTART;TZID=Europe/Oslo.*:20141126T170000' "out3C.tmp" \
4.211 +&& success || failed "out3C.tmp"
4.212
4.213 - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "requests" \
4.214 -> out3R.tmp
4.215 +# Expect a request at the sender.
4.216
4.217 - grep -q 'event6@example.com' "out3R.tmp" \
4.218 -&& echo "Success" \
4.219 -|| echo "Failed"
4.220 +list_script "out3R.tmp" "$SENDER" "requests"
4.221 +is_present "$UID1" "out3R.tmp" && success || failed "out3R.tmp"
4.222
4.223 # Check the free/busy state of the recipient so far.
4.224
4.225 - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \
4.226 -| "$SHOWMAIL" \
4.227 -> out4.tmp
4.228 +person_script "$TEMPLATES/fb-request-person-all.txt" "out4.tmp"
4.229
4.230 - grep -q 'METHOD:REPLY' out4.tmp \
4.231 -&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out4.tmp \
4.232 -&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T160000Z/20141126T170000Z' out4.tmp \
4.233 -&& echo "Success" \
4.234 -|| echo "Failed"
4.235 + is_present 'METHOD:REPLY' "out4.tmp" \
4.236 +&& is_absent '^FREEBUSY' "out4.tmp" \
4.237 +&& success || failed "out4.tmp"
4.238
4.239 # Decline the counter-proposal.
4.240 +# NOTE: Support this in the client.
4.241
4.242 - sed 's/COUNTER/DECLINECOUNTER/' < out2.tmp \
4.243 -| sed 's/^From: calendar/To: vincent.vole/' \
4.244 -| sed 's/^To: paul.boddie/From: paul.boddie/' \
4.245 -> out5.tmp
4.246 -
4.247 -"$OUTGOING_SCRIPT" $ARGS < out5.tmp 2>> $ERROR
4.248 + showmail "event_counter.tmp" \
4.249 +| sed 's/COUNTER/DECLINECOUNTER/' \
4.250 +| sed "s/^From: $USERADDRESS/To: $USERADDRESS/" \
4.251 +| sed "s/^To: $SENDERADDRESS/From: $SENDERADDRESS/" \
4.252 +> "event_declinecounter.tmp"
4.253
4.254 - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "countered_object" "event6@example.com" "$USER" \
4.255 -> out5C.tmp
4.256 +outgoing_script "event_declinecounter.tmp"
4.257 +
4.258 +# The countered object should be removed at the sender.
4.259
4.260 - ! grep -q 'event6@example.com' "out5C.tmp" \
4.261 -&& echo "Success" \
4.262 -|| echo "Failed"
4.263 +list_script "out5C.tmp" "$SENDER" "countered_object" "$UID1" "$USER"
4.264 +is_absent "$UID1" "out5C.tmp" && success || failed "out5C.tmp"
4.265
4.266 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "requests" \
4.267 -> out5R.tmp
4.268 +# The request should be removed at the sender.
4.269
4.270 - ! grep -q 'event6@example.com' "out5R.tmp" \
4.271 -&& echo "Success" \
4.272 -|| echo "Failed"
4.273 +list_script "out5R.tmp" "$SENDER" "requests"
4.274 +is_absent "$UID1" "out5R.tmp" && success || failed "out5R.tmp"
4.275
4.276 - "$PERSON_SCRIPT" $ARGS < out5.tmp 2>> $ERROR \
4.277 -| "$SHOWMAIL" \
4.278 -> out6.tmp
4.279 +# Present the decline message to the recipient.
4.280
4.281 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
4.282 -> out6f.tmp
4.283 +person_script "event_declinecounter.tmp" "out6.tmp"
4.284 +
4.285 +# Expect no free/busy periods at the recipient.
4.286
4.287 - ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out6f.tmp" \
4.288 -&& ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out6f.tmp" \
4.289 -&& echo "Success" \
4.290 -|| echo "Failed"
4.291 +list_script "out6f.tmp" "$USER" "freebusy"
4.292 +test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out6f.tmp"
4.293 +test_freebusy_missing '20141126T160000Z' '20141126T170000Z' "out6f.tmp"
4.294
4.295 - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \
4.296 -> out6o.tmp
4.297 +# Expect no free/busy offers at the recipient.
4.298
4.299 - ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out6o.tmp" \
4.300 -&& ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out6o.tmp" \
4.301 -&& echo "Success" \
4.302 -|| echo "Failed"
4.303 +list_script "out6o.tmp" "$USER" "freebusy_offers"
4.304 +test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out6o.tmp"
4.305 +test_freebusy_missing '20141126T160000Z' '20141126T170000Z' "out6o.tmp"