# HG changeset patch # User Paul Boddie # Date 1432232002 -7200 # Node ID 22b6b79d7b3da508fd08a0a180274c2d51d18910 # Parent 0fdb4147637590409d3924c7ee62b7f6239fc743 Added tests of recurring events and person recipients. diff -r 0fdb41476375 -r 22b6b79d7b3d tests/templates/event-cancel-person-recurring-instance.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/templates/event-cancel-person-recurring-instance.txt Thu May 21 20:13:22 2015 +0200 @@ -0,0 +1,37 @@ +Content-Type: multipart/alternative; boundary="===============0047278175==" +MIME-Version: 1.0 +From: paul.boddie@example.com +To: vincent.vole@example.com +Subject: Cancellation! + +Cancel an instance for vincent.vole and paul.boddie. + +--===============0047278175== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit + +This message contains an event. +--===============0047278175== +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/calendar; charset="us-ascii"; method="CANCEL" + +BEGIN:VCALENDAR +PRODID:-//imip-agent/test//EN +METHOD:CANCEL +VERSION:2.0 +BEGIN:VEVENT +ORGANIZER:mailto:paul.boddie@example.com +ATTENDEE;RSVP=TRUE:mailto:vincent.vole@example.com +ATTENDEE;RSVP=TRUE:mailto:paul.boddie@example.com +DTSTAMP:20141009T182400Z +DTSTART;TZID=Europe/Oslo:20141114T100000 +DTEND;TZID=Europe/Oslo:20141114T110000 +SUMMARY:Recurring event +UID:event8@example.com +RECURRENCE-ID:20141114T090000Z +END:VEVENT +END:VCALENDAR + +--===============0047278175==-- diff -r 0fdb41476375 -r 22b6b79d7b3d tests/templates/event-cancel-person-recurring.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/templates/event-cancel-person-recurring.txt Thu May 21 20:13:22 2015 +0200 @@ -0,0 +1,36 @@ +Content-Type: multipart/alternative; boundary="===============0047278175==" +MIME-Version: 1.0 +From: paul.boddie@example.com +To: vincent.vole@example.com +Subject: Cancellation! + +Cancel the event for vincent.vole and paul.boddie. + +--===============0047278175== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit + +This message contains an event. +--===============0047278175== +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/calendar; charset="us-ascii"; method="CANCEL" + +BEGIN:VCALENDAR +PRODID:-//imip-agent/test//EN +METHOD:CANCEL +VERSION:2.0 +BEGIN:VEVENT +ORGANIZER:mailto:paul.boddie@example.com +ATTENDEE;RSVP=TRUE:mailto:vincent.vole@example.com +ATTENDEE;RSVP=TRUE:mailto:paul.boddie@example.com +DTSTAMP:20141009T182400Z +DTSTART;TZID=Europe/Oslo:20141010T100000 +DTEND;TZID=Europe/Oslo:20141010T110000 +SUMMARY:Recurring event +UID:event8@example.com +END:VEVENT +END:VCALENDAR + +--===============0047278175==-- diff -r 0fdb41476375 -r 22b6b79d7b3d tests/templates/event-request-person-recurring-reschedule-instance.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/templates/event-request-person-recurring-reschedule-instance.txt Thu May 21 20:13:22 2015 +0200 @@ -0,0 +1,35 @@ +Content-Type: multipart/alternative; boundary="===============0047278175==" +MIME-Version: 1.0 +From: paul.boddie@example.com +To: vincent.vole@example.com +Subject: Invitation! + +--===============0047278175== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit + +This message contains an event. +--===============0047278175== +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/calendar; charset="us-ascii"; method="REQUEST" + +BEGIN:VCALENDAR +PRODID:-//imip-agent/test//EN +METHOD:REQUEST +VERSION:2.0 +BEGIN:VEVENT +ORGANIZER:mailto:paul.boddie@example.com +ATTENDEE;RSVP=TRUE:mailto:vincent.vole@example.com +DTSTAMP:20141009T182500Z +DTSTART;TZID=Europe/Oslo:20141011T100000 +DTEND;TZID=Europe/Oslo:20141011T110000 +SUMMARY:Recurring event +UID:event8@example.com +RECURRENCE-ID;TZID=Europe/Oslo:20141010T100000 +SEQUENCE:2 +END:VEVENT +END:VCALENDAR + +--===============0047278175==-- diff -r 0fdb41476375 -r 22b6b79d7b3d tests/templates/event-request-person-recurring.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/templates/event-request-person-recurring.txt Thu May 21 20:13:22 2015 +0200 @@ -0,0 +1,34 @@ +Content-Type: multipart/alternative; boundary="===============0047278175==" +MIME-Version: 1.0 +From: paul.boddie@example.com +To: vincent.vole@example.com +Subject: Invitation! + +--===============0047278175== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit + +This message contains an event. +--===============0047278175== +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/calendar; charset="us-ascii"; method="REQUEST" + +BEGIN:VCALENDAR +PRODID:-//imip-agent/test//EN +METHOD:REQUEST +VERSION:2.0 +BEGIN:VEVENT +ORGANIZER:mailto:paul.boddie@example.com +ATTENDEE;RSVP=TRUE:mailto:vincent.vole@example.com +DTSTAMP:20141009T182400Z +DTSTART;TZID=Europe/Oslo:20141010T100000 +DTEND;TZID=Europe/Oslo:20141010T110000 +RRULE:FREQ=MONTHLY;BYDAY=2FR;COUNT=3 +SUMMARY:Recurring event +UID:event8@example.com +END:VEVENT +END:VCALENDAR + +--===============0047278175==-- diff -r 0fdb41476375 -r 22b6b79d7b3d tests/test_person_invitation_recurring.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_person_invitation_recurring.sh Thu May 21 20:13:22 2015 +0200 @@ -0,0 +1,132 @@ +#!/bin/sh + +THIS_DIR=`dirname $0` + +TEMPLATES="$THIS_DIR/templates" +PERSON_SCRIPT="$THIS_DIR/../imip_person.py" +SHOWMAIL="$THIS_DIR/../tools/showmail.py" +STORE=/tmp/store +STATIC=/tmp/static +ARGS="-S $STORE -P $STATIC -d" +USER="mailto:vincent.vole@example.com" +SENDER="mailto:paul.boddie@example.com" +FBFILE="$STORE/$USER/freebusy" +FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER" +TAB=`printf '\t'` + +OUTGOING_SCRIPT="$THIS_DIR/../imip_person_outgoing.py" + +PYTHONPATH="$THIS_DIR/.." +export PYTHONPATH + +ACCEPT_SCRIPT="$THIS_DIR/test_handle.py" +ACCEPT_ARGS="accept $STORE" + +DECLINE_SCRIPT="$THIS_DIR/test_handle.py" +DECLINE_ARGS="decline $STORE" + +rm -r $STORE +rm -r $STATIC + + "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2> /dev/null \ +| "$SHOWMAIL" \ +> out0.tmp + + grep -q 'METHOD:REPLY' out0.tmp \ +&& ! grep -q '^FREEBUSY' out0.tmp \ +&& echo "Success" \ +|| echo "Failed" + + "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person.txt" 2> /dev/null \ +| "$SHOWMAIL" \ +> out1.tmp + + grep -q 'METHOD:REPLY' out1.tmp \ +&& ! grep -q '^FREEBUSY' out1.tmp \ +&& echo "Success" \ +|| echo "Failed" + + "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2> /dev/null \ +| "$SHOWMAIL" \ +> out2.tmp + + ! grep -q 'METHOD:REPLY' out2.tmp \ +&& echo "Success" \ +|| echo "Failed" + + ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \ +&& echo "Success" \ +|| echo "Failed" + + grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \ +&& echo "Success" \ +|| echo "Failed" + + "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" \ +| tee out3.tmp \ +| "$OUTGOING_SCRIPT" $ARGS + + grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \ +&& echo "Success" \ +|| echo "Failed" + + "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring-instance.txt" 2> /dev/null \ +| "$SHOWMAIL" \ +> out4.tmp + + ! grep -q 'METHOD:REPLY' out4.tmp \ +&& echo "Success" \ +|| echo "Failed" + + [ `grep "event8@example.com" "$FBFILE" | wc -l` = '2' ] \ +&& ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "$FBFILE" \ +&& echo "Success" \ +|| echo "Failed" + + [ `grep "event8@example.com" "$FBOTHERFILE" | wc -l` = '2' ] \ +&& ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "$FBOTHERFILE" \ +&& echo "Success" \ +|| echo "Failed" + + "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-reschedule-instance.txt" 2> /dev/null \ +| "$SHOWMAIL" \ +> out5.tmp + + ! grep -q 'METHOD:REPLY' out5.tmp \ +&& echo "Success" \ +|| echo "Failed" + + ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBFILE" \ +&& grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBFILE" \ +&& echo "Success" \ +|| echo "Failed" + + grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBOTHERFILE" \ +&& ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBOTHERFILE" \ +&& echo "Success" \ +|| echo "Failed" + + "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" "20141010T080000Z" \ +| tee out6.tmp \ +| "$OUTGOING_SCRIPT" $ARGS + + grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBFILE" \ +&& ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBFILE" \ +&& echo "Success" \ +|| echo "Failed" + + "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2> /dev/null \ +| "$SHOWMAIL" \ +> out6.tmp + + ! grep -q 'METHOD:REPLY' out6.tmp \ +&& echo "Success" \ +|| echo "Failed" + + ! grep -q "event8@example.com" "$FBFILE" \ +&& echo "Success" \ +|| echo "Failed" + + ! grep -q "event8@example.com" "$FBOTHERFILE" \ +&& echo "Success" \ +|| echo "Failed"