# HG changeset patch # User Paul Boddie # Date 1517697377 -3600 # Node ID ca3f430c3be5df600b9baf3af145cb42f65f464e # Parent 31ebbe000061c65ca22ecb63b2b2d54f95c7526e Updated another test to use the text client and helper functions. diff -r 31ebbe000061 -r ca3f430c3be5 tests/test_person_invitation_recurring.sh --- a/tests/test_person_invitation_recurring.sh Sat Feb 03 23:35:55 2018 +0100 +++ b/tests/test_person_invitation_recurring.sh Sat Feb 03 23:36:17 2018 +0100 @@ -12,319 +12,354 @@ mkdir -p "$PREFS/$SENDER" echo 'Europe/Oslo' > "$PREFS/$SENDER/TZID" -# Test free/busy responses. +# Test the recipient's initial free/busy state. - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \ -| "$SHOWMAIL" \ -> out0.tmp +test_initial_freebusy +test_initial_freebusy_limited - grep -q 'METHOD:REPLY' out0.tmp \ -&& ! grep -q '^FREEBUSY' out0.tmp \ -&& echo "Success" \ -|| echo "Failed" +# Make a new event. - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person.txt" 2>> $ERROR \ -| "$SHOWMAIL" \ -> out1.tmp +cat > "event_cmd.tmp" <> $ERROR +# Obtain the event UID. - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ -> out1f.tmp +read UID1 < "event_uid.tmp" + +# Register the event at the sender. - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out1f.tmp" \ -&& echo "Success" \ -|| echo "Failed" +outgoing_script "event_self.tmp" -# Test registration in the incoming handler for the recipient. +# Expect free/busy periods for the sender. + +list_script "out1f.tmp" "$SENDER" "freebusy" +test_freebusy '20141212T090000Z' '20141212T100000Z' "out1f.tmp" - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR \ -| "$SHOWMAIL" \ -> out2.tmp +# Present the request to the recipient. + +person_script "event.tmp" "out2.tmp" + +# Expect no reply because the recipient must handle the request. - ! grep -q 'METHOD:REPLY' out2.tmp \ -&& echo "Success" \ -|| echo "Failed" +is_absent 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp" - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out2f.tmp +# Expect no free/busy periods for the recipient. + +list_script "out2f.tmp" "$USER" "freebusy" +test_freebusy_missing '20141212T090000Z' '20141212T100000Z' "out2f.tmp" - ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out2f.tmp" \ -&& echo "Success" \ -|| echo "Failed" +# Expect free/busy periods for the sender at the recipient. + +list_script "out2fo.tmp" "$USER" "freebusy_other" "$SENDER" +test_freebusy '20141212T090000Z' '20141212T100000Z' "out2fo.tmp" - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ -> out2o.tmp +# Accept the invitation. - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out2o.tmp" \ -&& echo "Success" \ -|| echo "Failed" +cat > "event_accept_cmd.tmp" <> $ERROR \ -| tee out3.tmp \ -| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR +# Register the acceptance at the recipient. + +outgoing_script "event_accept.tmp" - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out3f.tmp +# Expect free/busy periods at the recipient. - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out3f.tmp" \ -&& echo "Success" \ -|| echo "Failed" +list_script "out2f2.tmp" "$USER" "freebusy" +test_freebusy '20141212T090000Z' '20141212T100000Z' "out2f2.tmp" + +# Cancel a recurrence of the event. -# Test recurrence cancellation in the outgoing handler. - -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring-instance.txt" 2>> $ERROR +cat > "event_cancel_cmd.tmp" < out3s.tmp +text_client_specific "$SENDER" "event_cancel_cmd.tmp" "$UID1" + +# Register the cancellation at the sender. - [ `grep "event8@example.com" "out3s.tmp" | wc -l` = '2' ] \ -&& ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "out3s.tmp" \ -&& echo "Success" \ -|| echo "Failed" +outgoing_script "event_cancel.tmp" + +# Expect only two periods at the sender. -# Test cancellation in the incoming handler. +list_script "out3s.tmp" "$SENDER" "freebusy" +test_freebusy_missing '20141114T090000Z' '20141114T100000Z' "out3s.tmp" +have_occurrences "$UID1" 2 "out3s.tmp" && success || failed "out3s.tmp" - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring-instance.txt" 2>> $ERROR \ -| "$SHOWMAIL" \ -> out4.tmp +# Register the cancellation at the recipient. - ! grep -q 'METHOD:REPLY' out4.tmp \ -&& echo "Success" \ -|| echo "Failed" +person_script "event_cancel.tmp" "out4.tmp" + +# Expect no reply from the recipient. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out4f.tmp +is_absent 'METHOD:REPLY' "out4.tmp" && success || failed "out4.tmp" + +# Expect only two periods at the recipient. - [ `grep "event8@example.com" "out4f.tmp" | wc -l` = '2' ] \ -&& ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "out4f.tmp" \ -&& echo "Success" \ -|| echo "Failed" +list_script "out4f.tmp" "$USER" "freebusy" +test_freebusy_missing '20141114T090000Z' '20141114T100000Z' "out4f.tmp" +have_occurrences "$UID1" 2 "out4f.tmp" && success || failed "out4f.tmp" + +# Expect only two periods for the sender at the recipient. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ -> out4o.tmp +list_script "out4fo.tmp" "$USER" "freebusy_other" "$SENDER" +test_freebusy_missing '20141114T090000Z' '20141114T100000Z' "out4fo.tmp" +have_occurrences "$UID1" 2 "out4fo.tmp" && success || failed "out4fo.tmp" + +# Reschedule the first period - [ `grep "event8@example.com" "out4o.tmp" | wc -l` = '2' ] \ -&& ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "out4o.tmp" \ -&& echo "Success" \ -|| echo "Failed" +cat > "event_reschedule_cmd.tmp" <> $ERROR +outgoing_script "event_reschedule.tmp" - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ -> out4s.tmp +# Expect a change in the first period at the sender. - grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out4s.tmp" \ -&& ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out4s.tmp" \ -&& echo "Success" \ -|| echo "Failed" +list_script "out4s.tmp" "$SENDER" "freebusy" +test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out4s.tmp" +test_freebusy '20141011T080000Z' '20141011T090000Z' "out4s.tmp" + +# Register the rescheduling at the recipient. -# Test rescheduling in the incoming handler. +person_script "event_reschedule.tmp" "out5.tmp" - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-reschedule-instance.txt" 2>> $ERROR \ -| "$SHOWMAIL" \ -> out5.tmp +# Expect no reply from the recipient. + +is_absent 'METHOD:REPLY' "out5.tmp" && success || failed "out5.tmp" - ! grep -q 'METHOD:REPLY' out5.tmp \ -&& echo "Success" \ -|| echo "Failed" +# Expect no change in the first period at the recipient. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out5f.tmp +list_script "out5f.tmp" "$USER" "freebusy" +test_freebusy '20141010T080000Z' '20141010T090000Z' "out5f.tmp" +test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out5f.tmp" - ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out5f.tmp" \ -&& grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out5f.tmp" \ -&& echo "Success" \ -|| echo "Failed" +# Expect a change in the first period for the sender at the recipient. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ -> out5o.tmp +list_script "out5fo.tmp" "$USER" "freebusy_other" "$SENDER" +test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out5fo.tmp" +test_freebusy '20141011T080000Z' '20141011T090000Z' "out5fo.tmp" + +# Accept the rescheduling. - grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out5o.tmp" \ -&& ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out5o.tmp" \ -&& echo "Success" \ -|| echo "Failed" +cat > "event_accept2_cmd.tmp" <> $ERROR \ -| tee out6.tmp \ -| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR +# Register the acceptance at the recipient. + +outgoing_script "event_accept2.tmp" - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out6f.tmp +# Expect a change in the first period at the recipient. + +list_script "out6f.tmp" "$USER" "freebusy" +test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out6f.tmp" +test_freebusy '20141011T080000Z' '20141011T090000Z' "out6f.tmp" - grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out6f.tmp" \ -&& ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out6f.tmp" \ -&& echo "Success" \ -|| echo "Failed" +# Prepare a complete cancellation. -# Test complete cancellation in the outgoing handler. - -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR - - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ -> out6s.tmp +cat > "event_cancel_all_cmd.tmp" <> $ERROR \ -| "$SHOWMAIL" \ -> out7.tmp +# Expect no periods at the sender. - ! grep -q 'METHOD:REPLY' out7.tmp \ -&& echo "Success" \ -|| echo "Failed" +list_script "out7s.tmp" "$SENDER" "freebusy" +have_occurrences "$UID1" 0 "out7s.tmp" && success || failed "out7s.tmp" + +# Register the cancellation at the recipient. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out7f.tmp +person_script "event_cancel_all.tmp" "out7.tmp" + +# Expect no reply from the recipient. - ! grep -q "event8@example.com" "out7f.tmp" \ -&& echo "Success" \ -|| echo "Failed" +is_absent 'METHOD:REPLY' "out7.tmp" && success || failed "out7.tmp" + +# Expect no periods at the recipient. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ -> out7o.tmp +list_script "out7f.tmp" "$USER" "freebusy" +have_occurrences "$UID1" 0 "out7f.tmp" && success || failed "out7f.tmp" - ! grep -q "event8@example.com" "out7o.tmp" \ -&& echo "Success" \ -|| echo "Failed" +# Expect no periods for the sender at the recipient. + +list_script "out7fo.tmp" "$USER" "freebusy_other" "$SENDER" +have_occurrences "$UID1" 0 "out7fo.tmp" && success || failed "out7fo.tmp" # Switch time zones. echo 'Europe/Mariehamn' > "$PREFS/$USER/TZID" -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR +# Register the event at the sender. - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ -> out7s.tmp +outgoing_script "event_self.tmp" + +# Expect free/busy periods for the sender. - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out7s.tmp" \ -&& echo "Success" \ -|| echo "Failed" +list_script "out8f.tmp" "$SENDER" "freebusy" +test_freebusy '20141212T090000Z' '20141212T100000Z' "out8f.tmp" - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR \ -| "$SHOWMAIL" \ -> out8.tmp +# Present the request to the recipient. - ! grep -q 'METHOD:REPLY' out8.tmp \ -&& echo "Success" \ -|| echo "Failed" +person_script "event.tmp" "out9.tmp" + +# Expect no reply because the recipient must handle the request. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out8f.tmp +is_absent 'METHOD:REPLY' "out9.tmp" && success || failed "out9.tmp" - ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out8f.tmp" \ -&& echo "Success" \ -|| echo "Failed" +# Expect no free/busy periods for the recipient. + +list_script "out9f.tmp" "$USER" "freebusy" +test_freebusy_missing '20141212T090000Z' '20141212T100000Z' "out9f.tmp" - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ -> out8o.tmp +# Expect free/busy periods for the sender at the recipient. - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out8o.tmp" \ -&& echo "Success" \ -|| echo "Failed" +list_script "out9fo.tmp" "$USER" "freebusy_other" "$SENDER" +test_freebusy '20141212T090000Z' '20141212T100000Z' "out9fo.tmp" - "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \ -| tee out9.tmp \ -| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR +text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1" + +# Register the acceptance at the recipient. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out9f.tmp +outgoing_script "event_accept.tmp" - grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out9f.tmp" \ -&& echo "Success" \ -|| echo "Failed" +# Expect free/busy periods at the recipient. + +list_script "out9f2.tmp" "$USER" "freebusy" +test_freebusy '20141212T090000Z' '20141212T100000Z' "out9f2.tmp" -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR +# Cancel the event. + +outgoing_script "event_cancel_all.tmp" - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ -> out9s.tmp +# Expect no periods at the sender. - ! grep -q "event8@example.com" "out9s.tmp" \ -&& echo "Success" \ -|| echo "Failed" +list_script "out10s.tmp" "$SENDER" "freebusy" +have_occurrences "$UID1" 0 "out10s.tmp" && success || failed "out10s.tmp" - "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR \ -| "$SHOWMAIL" \ -> out10.tmp +# Register the cancellation at the recipient. + +person_script "event_cancel_all.tmp" "out10.tmp" - ! grep -q 'METHOD:REPLY' out10.tmp \ -&& echo "Success" \ -|| echo "Failed" +# Expect no reply from the recipient. - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out10f.tmp +is_absent 'METHOD:REPLY' "out10.tmp" && success || failed "out10.tmp" - ! grep -q "event8@example.com" "out10f.tmp" \ -&& echo "Success" \ -|| echo "Failed" +# Expect no periods at the recipient. + +list_script "out10f.tmp" "$USER" "freebusy" +have_occurrences "$UID1" 0 "out10f.tmp" && success || failed "out10f.tmp" - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ -> out10o.tmp +# Expect no periods for the sender at the recipient. - ! grep -q "event8@example.com" "out10o.tmp" \ -&& echo "Success" \ -|| echo "Failed" +list_script "out10fo.tmp" "$USER" "freebusy_other" "$SENDER" +have_occurrences "$UID1" 0 "out10fo.tmp" && success || failed "out10fo.tmp" # Test floating dates. Here, the outgoing interpretation is different because # the sender is in a different time zone. -"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-day-floating.txt" 2>> $ERROR - - "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ -> out10s.tmp - - grep -q "^20141211T230000Z${TAB}20141212T230000Z" "out10s.tmp" \ -&& echo "Success" \ -|| echo "Failed" +cat > "event_floating_cmd.tmp" <> $ERROR \ -| "$SHOWMAIL" \ -> out11.tmp +text_client "$SENDER" "event_floating_cmd.tmp" + +# Obtain the event UID. + +read UID2 < "event_floating_uid.tmp" - ! grep -q 'METHOD:REPLY' out11.tmp \ -&& echo "Success" \ -|| echo "Failed" +# Register the event at the sender. + +outgoing_script "event_floating_self.tmp" - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out11f.tmp +# Expect free/busy periods for the sender. + +list_script "out11s.tmp" "$SENDER" "freebusy" +test_freebusy '20141211T230000Z' '20141212T230000Z' "out11s.tmp" - ! grep -q "^20141211T220000Z${TAB}20141212T220000Z" "out11f.tmp" \ -&& echo "Success" \ -|| echo "Failed" +# Present the request to the recipient. + +person_script "event_floating.tmp" "out11.tmp" + +# Expect no reply because the recipient must handle the request. + +is_absent 'METHOD:REPLY' "out11.tmp" && success || failed "out11.tmp" -# (The organiser is not attending.) +# Expect no free/busy periods for the recipient (in either time zone). - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \ -> out11o.tmp +list_script "out11f.tmp" "$USER" "freebusy" +test_freebusy_missing '20141211T220000Z' '20141212T220000Z' "out11f.tmp" +test_freebusy_missing '20141211T230000Z' '20141212T230000Z' "out11f.tmp" + +# Expect no free/busy periods for the sender at the recipient. +# The organiser is not attending. - ! grep -q "^20141211T220000Z${TAB}20141212T220000Z" "out11o.tmp" \ -&& echo "Success" \ -|| echo "Failed" +list_script "out11fo.tmp" "$USER" "freebusy_other" "$SENDER" +test_freebusy_missing '20141211T220000Z' '20141212T220000Z' "out11fo.tmp" +test_freebusy_missing '20141211T230000Z' '20141212T230000Z' "out11fo.tmp" + +# Accept the invitation. + +text_client_specific "$USER" "event_accept_cmd.tmp" "$UID2" - "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event12@example.com" 2>> $ERROR \ -| tee out12.tmp \ -| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR +# Register the acceptance at the recipient. + +outgoing_script "event_accept.tmp" - "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ -> out12f.tmp +# Expect free/busy periods at the recipient (in the appropriate time zone). - grep -q "^20141211T220000Z${TAB}20141212T220000Z" "out12f.tmp" \ -&& echo "Success" \ -|| echo "Failed" +list_script "out12f.tmp" "$USER" "freebusy" +test_freebusy '20141211T220000Z' '20141212T220000Z' "out12f.tmp" +test_freebusy_missing '20141211T230000Z' '20141212T230000Z' "out12f.tmp"