# HG changeset patch # User Paul Boddie # Date 1522359297 -7200 # Node ID ac004e96168558da11f613ab5b43096bd897d4b8 # Parent 977b3f6d785acd631e4dec759ec1113e165a579a Changed tests to use the text client and convenience functions. diff -r 977b3f6d785a -r ac004e961685 tests/test_multiple_invitation.sh --- a/tests/test_multiple_invitation.sh Thu Mar 29 23:28:32 2018 +0200 +++ b/tests/test_multiple_invitation.sh Thu Mar 29 23:34:57 2018 +0200 @@ -2,6 +2,7 @@ . "`dirname \"$0\"`/common.sh" +SENDER="mailto:paul.boddie@example.com" ROOM="mailto:resource-room-confroom@example.com" CAR="mailto:resource-car-porsche911@example.com" @@ -13,77 +14,141 @@ echo 'Europe/Mariehamn' > "$PREFS/$CAR/TZID" echo 'share' > "$PREFS/$CAR/freebusy_sharing" - "$RESOURCE_SCRIPT" $ARGS < $TEMPLATES/fb-request-all.txt 2>> $ERROR \ -| "$SHOWMAIL" \ -> out0.tmp +# Test the recipient's initial free/busy state. - grep -q 'METHOD:REPLY' out0.tmp \ -&& ! grep -q '^FREEBUSY' out0.tmp \ -&& echo "Success" \ -|| echo "Failed" +test_initial_freebusy 'resource' +test_initial_freebusy_limited 'resource' + +# Make a new event. - "$RESOURCE_SCRIPT" $ARGS < $TEMPLATES/fb-request.txt 2>> $ERROR \ -| "$SHOWMAIL" \ -> out1.tmp +cat > "event_cmd.tmp" <> $ERROR \ -| "$SHOWMAIL" \ -> out2.tmp +# Expect replies because each recipient handles the request. + +# Inspect the room's response. + +is_present 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp" +is_present 'ATTENDEE;PARTSTAT=ACCEPTED' "out2.tmp" && success || failed "out2.tmp" - grep -q 'METHOD:REPLY' out2.tmp \ -&& grep -q 'ATTENDEE;PARTSTAT=ACCEPTED' out2.tmp \ -&& echo "Success" \ -|| echo "Failed" +# Inspect the car's response. + +showmail "out2r.tmp" 1 | is_present 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp" +showmail "out2r.tmp" 1 | is_present 'ATTENDEE;PARTSTAT=ACCEPTED' "out2.tmp" && success || failed "out2.tmp" + +# Expect free/busy periods for the recipients. - "$RESOURCE_SCRIPT" $ARGS -o 'resource-car-porsche911@example.com' < "$TEMPLATES/event-request-multiple.txt" 2>> $ERROR \ -| "$SHOWMAIL" \ -> out3.tmp +list_script "out2f1.tmp" "$ROOM" "freebusy" +test_freebusy '20141126T150000Z' '20141126T160000Z' "out2f1.tmp" +list_script "out2f2.tmp" "$CAR" "freebusy" +test_freebusy '20141126T150000Z' '20141126T160000Z' "out2f2.tmp" + +# Present a new free/busy request to the resources. +# NOTE: We might open the event and use that for the request. - grep -q 'METHOD:REPLY' out3.tmp \ -&& grep -q 'ATTENDEE;PARTSTAT=ACCEPTED' out3.tmp \ -&& echo "Success" \ -|| echo "Failed" +cat > "fb_cmd.tmp" <> $ERROR \ -| "$SHOWMAIL" \ -> out4.tmp +resource_script "fb.tmp" "out4.tmp" "out4r.tmp" + +# Expect replies because each recipient handles the request. + +# Inspect the room's response. - grep -q 'METHOD:REPLY' out4.tmp \ -&& grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out4.tmp \ -&& echo "Success" \ -|| echo "Failed" +is_present 'METHOD:REPLY' "out4.tmp" && success || failed "out4.tmp" +is_present 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' "out4.tmp" && success || failed "out4.tmp" + +# Inspect the car's response. + +showmail "out4r.tmp" 1 | is_present 'METHOD:REPLY' "out4.tmp" && success || failed "out4.tmp" +showmail "out4r.tmp" 1 | is_present 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' "out4.tmp" && success || failed "out4.tmp" - "$RESOURCE_SCRIPT" $ARGS -o 'resource-car-porsche911@example.com' < "$TEMPLATES/fb-request-car.txt" 2>> $ERROR \ -| "$SHOWMAIL" \ -> out5.tmp +# Cancel the attendance of the conference room. + +cat > "event_cancel_cmd.tmp" <> $ERROR -echo "Cancel..." +cat > "fb_room_cmd.tmp" <> $ERROR \ -| "$SHOWMAIL" \ -> out6.tmp +text_client "$SENDER" "fb_room_cmd.tmp" + +# Present the request to the recipients. + +resource_script "fb_room.tmp" "out6.tmp" + +# Expect a reply but with no free/busy periods. + +is_present 'METHOD:REPLY' "out6.tmp" && success || failed "out6.tmp" +is_absent 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' "out6.tmp" && success || failed "out6.tmp" - grep -q 'METHOD:REPLY' out6.tmp \ -&& ! grep -q '^FREEBUSY' out6.tmp \ -&& echo "Success" \ -|| echo "Failed" +# Present a new free/busy request to each resource. + +cat > "fb_car_cmd.tmp" <> $ERROR \ -| "$SHOWMAIL" \ -> out7.tmp +text_client "$SENDER" "fb_car_cmd.tmp" + +# Present the request to the recipients. - grep -q 'METHOD:REPLY' out7.tmp \ -&& grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out7.tmp \ -&& echo "Success" \ -|| echo "Failed" +resource_script "fb_car.tmp" "out7.tmp" + +# Expect a reply with free/busy periods. + +is_present 'METHOD:REPLY' "out7.tmp" && success || failed "out7.tmp" +is_present 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' "out7.tmp" && success || failed "out7.tmp" diff -r 977b3f6d785a -r ac004e961685 tests/test_outgoing_invitation.sh --- a/tests/test_outgoing_invitation.sh Thu Mar 29 23:28:32 2018 +0200 +++ b/tests/test_outgoing_invitation.sh Thu Mar 29 23:34:57 2018 +0200 @@ -3,126 +3,249 @@ . "`dirname \"$0\"`/common.sh" USER="mailto:paul.boddie@example.com" +SENDER=$USER mkdir -p "$PREFS/$USER" echo 'Europe/Oslo' > "$PREFS/$USER/TZID" echo 'share' > "$PREFS/$USER/freebusy_sharing" echo '20141010' > "$PREFS/$USER/window_start" -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request.txt" 2>> $ERROR +# Make a new event. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -| tee out1.tmp \ -| grep -q "^20141126T150000Z${TAB}20141126T160000Z" \ -&& echo "Success" \ -|| echo "Failed" +cat > "event_cmd.tmp" <> $ERROR -echo "Cancel..." +# Expect a free/busy period for the sender at the sender. + +list_script "out1f.tmp" "$SENDER" "freebusy" +test_freebusy '20141126T150000Z' '20141126T160000Z' "out1f.tmp" + +# Cancel the event. + +cat > "event_cancel_cmd.tmp" < out2.tmp +text_client_specific "$SENDER" "event_cancel_cmd.tmp" "$UID1" + +# Present the cancellation at the sender. + +outgoing_script "event_cancel.tmp" - ! grep -q '^2' "out2.tmp" \ -&& echo "Success" \ -|| echo "Failed" +# Expect no free/busy periods for the sender at the sender. + +list_script "out2f.tmp" "$SENDER" "freebusy" +test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out2f.tmp" +have_occurrences "$UID1" 0 "out2f.tmp" && success || failed "out2f.tmp" -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring.txt" 2>> $ERROR - - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out3.tmp +# Make a recurring event. - [ `cat "out3.tmp" | wc -l` = '3' ] \ -&& grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out3.tmp" \ -&& echo "Success" \ -|| echo "Failed" +cat > "event_recurring_cmd.tmp" <> $ERROR +# Register the event at the sender. + +outgoing_script "event_recurring_self.tmp" + +# Expect free/busy periods for the sender at the sender. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out4.tmp +list_script "out3f.tmp" "$SENDER" "freebusy" +test_freebusy '20141010T080000Z' '20141010T090000Z' "out3f.tmp" +have_occurrences "$UID2" 3 "out3f.tmp" && success || failed "out3f.tmp" + +# Cancel a recurrence. - [ `cat "out4.tmp" | wc -l` = '2' ] \ -&& ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "out4.tmp" \ -&& echo "Success" \ -|| echo "Failed" +cat > "event_cancel_recurring_cmd.tmp" <> $ERROR +# Expect fewer free/busy periods for the sender at the sender. + +list_script "out4f.tmp" "$SENDER" "freebusy" +test_freebusy '20141010T080000Z' '20141010T090000Z' "out4f.tmp" +test_freebusy_missing '20141114T090000Z' '20141114T100000Z' "out4f.tmp" +have_occurrences "$UID2" 2 "out4f.tmp" && success || failed "out4f.tmp" + +# Reschedule an instance. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out5.tmp +cat > "event_reschedule_cmd.tmp" <> $ERROR +# Cancel the event. + +cat > "event_cancel_recurring_all_cmd.tmp" < out6.tmp +text_client_specific "$SENDER" "event_cancel_recurring_all_cmd.tmp" "$UID2" + +# Present the cancellation at the sender. + +outgoing_script "event_cancel_recurring_all.tmp" - ! grep -q '^2' "out6.tmp" \ -&& echo "Success" \ -|| echo "Failed" +# Expect no free/busy periods for the sender at the sender. + +list_script "out6f.tmp" "$SENDER" "freebusy" +test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out6f.tmp" +have_occurrences "$UID2" 0 "out6f.tmp" && success || failed "out6f.tmp" + +# Make a recurring all-day event. -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-day.txt" 2>> $ERROR +cat > "event_recurring_day_cmd.tmp" < out7.tmp +text_client "$SENDER" "event_recurring_day_cmd.tmp" + +# Obtain the event UID. + +read UID3 < "event_recurring_day_uid.tmp" + +# Register the event at the sender. - [ `cat "out7.tmp" | wc -l` = '3' ] \ -&& grep -q "^20141211T230000Z${TAB}20141212T230000Z" "out7.tmp" \ -&& echo "Success" \ -|| echo "Failed" +outgoing_script "event_recurring_day_self.tmp" + +# Expect free/busy periods for the sender at the sender. -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring-day.txt" 2>> $ERROR +list_script "out7f.tmp" "$SENDER" "freebusy" +test_freebusy '20141211T230000Z' '20141212T230000Z' "out7f.tmp" +have_occurrences "$UID3" 3 "out7f.tmp" && success || failed "out7f.tmp" + +# Cancel the event. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out8.tmp +cat > "event_cancel_recurring_day_cmd.tmp" < "$PREFS/$USER/TZID" -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring.txt" 2>> $ERROR +# Register the recurring event at the sender. + +outgoing_script "event_recurring_self.tmp" - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out9.tmp +# Expect free/busy periods for the sender at the sender. + +list_script "out9f.tmp" "$SENDER" "freebusy" +test_freebusy '20141010T080000Z' '20141010T090000Z' "out9f.tmp" +have_occurrences "$UID2" 3 "out9f.tmp" && success || failed "out9f.tmp" - [ `cat "out9.tmp" | wc -l` = '3' ] \ -&& grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out9.tmp" \ -&& echo "Success" \ -|| echo "Failed" +# Present the cancellation of the recurring event at the sender. -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring.txt" 2>> $ERROR +outgoing_script "event_cancel_recurring_all.tmp" - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out10.tmp +# Expect no free/busy periods for the sender at the sender. - ! grep -q '^2' "out10.tmp" \ -&& echo "Success" \ -|| echo "Failed" +list_script "out10f.tmp" "$SENDER" "freebusy" +test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out10f.tmp" +have_occurrences "$UID2" 0 "out10f.tmp" && success || failed "out10f.tmp" -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-day.txt" 2>> $ERROR +# Register the recurring all-day event at the sender. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out11.tmp +outgoing_script "event_recurring_day_self.tmp" + +# Expect free/busy periods for the sender at the sender. +# With the changed time zone, the periods will be earlier than before. - [ `cat "out11.tmp" | wc -l` = '3' ] \ -&& grep -q "^20141211T230000Z${TAB}20141212T230000Z" "out11.tmp" \ -&& echo "Success" \ -|| echo "Failed" +list_script "out11f.tmp" "$SENDER" "freebusy" +test_freebusy '20141211T220000Z' '20141212T220000Z' "out11f.tmp" +have_occurrences "$UID3" 3 "out11f.tmp" && success || failed "out11f.tmp" -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring-day.txt" 2>> $ERROR +# Present the cancellation at the sender. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out12.tmp +outgoing_script "event_cancel_recurring_day.tmp" + +# Expect no free/busy periods for the sender at the sender. - ! grep -q '^2' "out12.tmp" \ -&& echo "Success" \ -|| echo "Failed" +list_script "out12f.tmp" "$SENDER" "freebusy" +test_freebusy_missing '20141211T220000Z' '20141212T220000Z' "out12f.tmp" +have_occurrences "$UID2" 0 "out12f.tmp" && success || failed "out12f.tmp"