# HG changeset patch # User Paul Boddie # Date 1438104447 -7200 # Node ID 1d28f68285a3b832f7d0aca533c29f8935889b97 # Parent 99179474c93ad827937422ff53766103739c7f45 Added more missing support for UTC time zone attributes, plus related tests. diff -r 99179474c93a -r 1d28f68285a3 imiptools/dates.py --- a/imiptools/dates.py Tue Jul 28 00:14:57 2015 +0200 +++ b/imiptools/dates.py Tue Jul 28 19:27:27 2015 +0200 @@ -368,6 +368,8 @@ attr = {"VALUE" : "DATE-TIME"} if tzid: attr["TZID"] = tzid + elif dt.tzname() == "UTC": + attr["TZID"] = "UTC" return attr else: return {"VALUE" : "DATE"} @@ -376,7 +378,10 @@ def get_datetime_item(dt, tzid=None): - "Return an iCalendar-compatible string and attributes for 'dt' and 'tzid'." + """ + Return an iCalendar-compatible string and attributes for 'dt' using any + specified 'tzid' to assert a particular time zone. + """ if not dt: return None, None diff -r 99179474c93a -r 1d28f68285a3 tests/templates/event-request-conflict-utc.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/templates/event-request-conflict-utc.txt Tue Jul 28 19:27:27 2015 +0200 @@ -0,0 +1,34 @@ +Content-Type: multipart/alternative; boundary="===============0047278175==" +MIME-Version: 1.0 +From: paul.boddie@example.com +To: resource-room-confroom@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;ROLE=CHAIR:mailto:paul.boddie@example.com +ATTENDEE;RSVP=TRUE:mailto:resource-room-confroom@example.com +DTSTAMP:20141125T004600Z +DTSTART:20141126T150000Z +DTEND:20141126T160000Z +SUMMARY:Meeting at 3pm UTC +UID:event9@example.com +END:VEVENT +END:VCALENDAR + +--===============0047278175==-- diff -r 99179474c93a -r 1d28f68285a3 tests/test_resource_invitation.sh --- a/tests/test_resource_invitation.sh Tue Jul 28 00:14:57 2015 +0200 +++ b/tests/test_resource_invitation.sh Tue Jul 28 19:27:27 2015 +0200 @@ -60,13 +60,22 @@ && echo "Success" \ || echo "Failed" - "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-conflict-utc.txt" 2>> $ERROR \ | "$SHOWMAIL" \ > out5.tmp grep -q 'METHOD:REPLY' out5.tmp \ -&& grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out5.tmp \ -&& [ `grep 'FREEBUSY;FBTYPE=BUSY' out5.tmp | wc -l` = '1' ] \ +&& grep -q 'ATTENDEE;PARTSTAT=DECLINED' out5.tmp \ +&& echo "Success" \ +|| echo "Failed" + + "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ +| "$SHOWMAIL" \ +> out6.tmp + + grep -q 'METHOD:REPLY' out6.tmp \ +&& grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out6.tmp \ +&& [ `grep 'FREEBUSY;FBTYPE=BUSY' out6.tmp | wc -l` = '1' ] \ && echo "Success" \ || echo "Failed" @@ -75,10 +84,10 @@ "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ | "$SHOWMAIL" \ -> out6.tmp +> out7.tmp - grep -q 'METHOD:REPLY' out6.tmp \ -&& ! grep -q '^FREEBUSY' out6.tmp \ + grep -q 'METHOD:REPLY' out7.tmp \ +&& ! grep -q '^FREEBUSY' out7.tmp \ && echo "Success" \ || echo "Failed" @@ -87,9 +96,9 @@ "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ | "$SHOWMAIL" \ -> out7.tmp +> out8.tmp - grep -q 'METHOD:REPLY' out7.tmp \ -&& ! grep -q '^FREEBUSY' out7.tmp \ + grep -q 'METHOD:REPLY' out8.tmp \ +&& ! grep -q '^FREEBUSY' out8.tmp \ && echo "Success" \ || echo "Failed"