# HG changeset patch # User Paul Boddie # Date 1431962042 -7200 # Node ID 0c39045b0614425d0d6d2bcd8d2c35ef24c161ea # Parent b8342c472aa9d2c794d5b5f77ecc0d7977c8f0f4 Added testing templates and a tool to show encoded mail messages. diff -r b8342c472aa9 -r 0c39045b0614 tests/templates/event-request-conflict.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/templates/event-request-conflict.txt Mon May 18 17:14:02 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;TZID=Europe/Oslo:20141126T160000 +DTEND;TZID=Europe/Oslo:20141126T170000 +SUMMARY:A conflicting meeting at 4pm +UID:event2@example.com +END:VEVENT +END:VCALENDAR + +--===============0047278175==-- diff -r b8342c472aa9 -r 0c39045b0614 tests/templates/event-request.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/templates/event-request.txt Mon May 18 17:14:02 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;TZID=Europe/Oslo:20141126T160000 +DTEND;TZID=Europe/Oslo:20141126T170000 +SUMMARY:Meeting at 4pm +UID:event1@example.com +END:VEVENT +END:VCALENDAR + +--===============0047278175==-- diff -r b8342c472aa9 -r 0c39045b0614 tests/templates/fb-request.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/templates/fb-request.txt Mon May 18 17:14:02 2015 +0200 @@ -0,0 +1,31 @@ +Content-Type: multipart/alternative; boundary="===============0945993647==" +MIME-Version: 1.0 +From: paul.boddie@example.com +To: resource-room-confroom@example.com + +--===============0945993647== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit + +This message contains a free/busy request. +--===============0945993647== +Content-Type: text/calendar; charset="us-ascii"; method="REQUEST" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit + +BEGIN:VCALENDAR +PRODID:-//imip-agent/test//EN +METHOD:REQUEST +VERSION:2.0 +BEGIN:VFREEBUSY +ORGANIZER:mailto:paul.boddie@example.com +ATTENDEE:mailto:resource-room-confroom@example.com +DTSTAMP:20141125T164400Z +DTSTART:20141126T150000Z +DTEND:20141126T180000Z +UID:fb1@example.com +END:VFREEBUSY +END:VCALENDAR + +--===============0945993647==-- diff -r b8342c472aa9 -r 0c39045b0614 tools/showmail.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/showmail.py Mon May 18 17:14:02 2015 +0200 @@ -0,0 +1,17 @@ +from email import message_from_file +import sys + +def decode(part): + for key, value in part.items(): + print "%s: %s" % (key, value) + print + decoded = part.get_payload(decode=True) + if decoded: + print decoded + print + else: + for part in part.get_payload(): + decode(part) + +message = message_from_file(sys.stdin) +decode(message)