# HG changeset patch # User Paul Boddie # Date 1438467099 -7200 # Node ID c8ad50a04516f27866badecc3d07d76d574ce2a0 # Parent d12ea7a299cb4dfc7cc55716e16c13bf6e54b199 Added a test of free/busy publishing. diff -r d12ea7a299cb -r c8ad50a04516 tests/templates/fb-publish-again.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/templates/fb-publish-again.txt Sun Aug 02 00:11:39 2015 +0200 @@ -0,0 +1,33 @@ +Content-Type: multipart/alternative; boundary="===============0945993647==" +MIME-Version: 1.0 +From: resource-room-confroom@example.com +To: paul.boddie@example.com +Subject: Availability + +--===============0945993647== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit + +This message contains a free/busy object. +--===============0945993647== +Content-Type: text/calendar; charset="us-ascii"; method="PUBLISH" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit + +BEGIN:VCALENDAR +PRODID:-//imip-agent/test//EN +METHOD:PUBLISH +VERSION:2.0 +BEGIN:VFREEBUSY +ORGANIZER:mailto:resource-room-confroom@example.com +ATTENDEE:mailto:paul.boddie@example.com +UID:mailto:resource-room-confroom@example.com +DTSTAMP:20141001T173916Z +DTSTART:20140401T080000Z +DTEND:20140401T100000Z +FREEBUSY;FBTYPE=BUSY:20140401T083000Z/20140401T100000Z +END:VFREEBUSY +END:VCALENDAR + +--===============0945993647==-- diff -r d12ea7a299cb -r c8ad50a04516 tests/templates/fb-publish.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/templates/fb-publish.txt Sun Aug 02 00:11:39 2015 +0200 @@ -0,0 +1,32 @@ +Content-Type: multipart/alternative; boundary="===============0945993647==" +MIME-Version: 1.0 +From: resource-room-confroom@example.com +To: paul.boddie@example.com +Subject: Availability + +--===============0945993647== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit + +This message contains a free/busy object. +--===============0945993647== +Content-Type: text/calendar; charset="us-ascii"; method="PUBLISH" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit + +BEGIN:VCALENDAR +PRODID:-//imip-agent/test//EN +METHOD:PUBLISH +VERSION:2.0 +BEGIN:VFREEBUSY +ORGANIZER:mailto:resource-room-confroom@example.com +ATTENDEE:mailto:paul.boddie@example.com +UID:mailto:resource-room-confroom@example.com +DTSTAMP:20140301T163916Z +FREEBUSY;FBTYPE=BUSY:20140401T070000Z/20140401T080000Z +FREEBUSY;FBTYPE=BUSY:20140401T080000Z/20140401T100000Z +END:VFREEBUSY +END:VCALENDAR + +--===============0945993647==-- diff -r d12ea7a299cb -r c8ad50a04516 tests/test_freebusy_publishing.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_freebusy_publishing.sh Sun Aug 02 00:11:39 2015 +0200 @@ -0,0 +1,44 @@ +#!/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:paul.boddie@example.com" +SENDER="mailto:resource-room-confroom@example.com" +FBFILE="$STORE/$USER/freebusy" +FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER" +TAB=`printf '\t'` + +PYTHONPATH="$THIS_DIR/.." +export PYTHONPATH + +ERROR=err.tmp + +rm -r $STORE +rm -r $STATIC +rm $ERROR +rm out*.tmp + + "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-publish.txt" 2>> $ERROR \ +| "$SHOWMAIL" \ +> out0.tmp + + grep -q "^20140401T070000Z${TAB}20140401T080000Z" "$FBOTHERFILE" \ +&& grep -q "^20140401T080000Z${TAB}20140401T100000Z" "$FBOTHERFILE" \ +&& echo "Success" \ +|| echo "Failed" + + "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-publish-again.txt" 2>> $ERROR \ +| "$SHOWMAIL" \ +> out0.tmp + + grep -q "^20140401T070000Z${TAB}20140401T080000Z" "$FBOTHERFILE" \ +&& ! grep -q "^20140401T080000Z${TAB}20140401T100000Z" "$FBOTHERFILE" \ +&& grep -q "^20140401T083000Z${TAB}20140401T100000Z" "$FBOTHERFILE" \ +&& echo "Success" \ +|| echo "Failed"