Skip to content
Permalink
Browse files

Test to make sure only valid utf-8 calendar data is processed.

  • Loading branch information...
cyrusdaboo committed Mar 28, 2008
1 parent b13072d commit 78a3e4d601227bdda723ca9fb956de49f9c84674
Showing with 209 additions and 1 deletion.
  1. +30 −0 Resource/nonascii/10.ics
  2. +34 −0 Resource/nonascii/11.ics
  3. +145 −1 scripts/tests/nonascii.xml
@@ -0,0 +1,30 @@
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
PRODID:-//Cyrusoft International\, Inc.//Mulberry v4.0//EN
VERSION:2.0
BEGIN:VTIMEZONE
LAST-MODIFIED:20040110T032845Z
TZID:US/Eastern
BEGIN:DAYLIGHT
DTSTART:20000404T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20001026T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20051222T205953Z
DTSTART;TZID=US/Eastern:20060101T100000
DURATION:PT1H
SUMMARY:�test�
UID:54E181BC7CCC373042B28842@ninevah.local
END:VEVENT
END:VCALENDAR
@@ -0,0 +1,34 @@
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
PRODID:-//Cyrusoft International\, Inc.//Mulberry v4.0//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VTIMEZONE
LAST-MODIFIED:20040110T032845Z
TZID:US/Eastern
BEGIN:DAYLIGHT
DTSTART:20000404T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20001026T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20051222T205953Z
DTSTART;TZID=US/Eastern:20060101T100000
DURATION:PT1H
SUMMARY:�test�
UID:54E181BC7CCC373042B28842@ninevah.local
ORGANIZER;CN=User 01:$cuaddr1:
ATTENDEE;CN=User 02:$cuaddr2:
ATTENDEE;CN=User 03:$cuaddr3:
END:VEVENT
END:VCALENDAR
@@ -23,7 +23,12 @@
<caldavtest>
<description>Test use of UTF-8 for HTTP and calendar data</description>

<start/>
<start>
<request end-delete="yes">
<method>MKCOL</method>
<ruri>$pathprefix:/collection/</ruri>
</request>
</start>

<test-suite name='MKCALENDAR' ignore="yes">
<test name='1'>
@@ -376,6 +381,145 @@
</test>
</test-suite>

<test-suite name='Non-utf-8 calendar data' ignore="no">
<test name='1'>
<description>PUT with non-utf-8 data without charset</description>
<request end-delete="yes">
<method>PUT</method>
<ruri>nonutf8.ics</ruri>
<data>
<content-type>text/calendar</content-type>
<filepath>Resource/nonascii/10.ics</filepath>
</data>
<verify>
<callback>prepostcondition</callback>
<arg>
<name>error</name>
<value>urn:ietf:params:xml:ns:caldavvalid-calendar-data</value>
</arg>
</verify>
</request>
</test>
<test name='2'>
<description>PUT with non-utf-8 data with utf-8 charset</description>
<request end-delete="yes">
<method>PUT</method>
<ruri>nonutf8.ics</ruri>
<data>
<content-type>text/calendar; charset=utf-8</content-type>
<filepath>Resource/nonascii/10.ics</filepath>
</data>
<verify>
<callback>prepostcondition</callback>
<arg>
<name>error</name>
<value>urn:ietf:params:xml:ns:caldavvalid-calendar-data</value>
</arg>
</verify>
</request>
</test>
<test name='3'>
<description>PUT with non-utf-8 data with non-utf-8 charset</description>
<request end-delete="yes">
<method>PUT</method>
<ruri>nonutf8.ics</ruri>
<data>
<content-type>text/calendar; charset=iso-8859-1</content-type>
<filepath>Resource/nonascii/10.ics</filepath>
</data>
<verify>
<callback>prepostcondition</callback>
<arg>
<name>error</name>
<value>urn:ietf:params:xml:ns:caldavvalid-calendar-data</value>
</arg>
</verify>
</request>
</test>
</test-suite>

<test-suite name='Copy/Move Non-utf-8 calendar data' ignore="no">
<test name='1'>
<description>PUT with non-utf-8 data to regular collection</description>
<request end-delete="yes">
<method>PUT</method>
<ruri>$pathprefix:/collection/nonutf8.ics</ruri>
<data>
<content-type>text/calendar</content-type>
<filepath>Resource/nonascii/10.ics</filepath>
</data>
<verify>
<callback>statusCode</callback>
</verify>
</request>
</test>
<test name='2'>
<description>COPY non-utf-8 data to calendar collection</description>
<request end-delete="yes">
<method>COPY</method>
<header>
<name>Destination</name>
<value>$host:$calendarpath1:/copy1.ics</value>
</header>
<ruri>$pathprefix:/collection/nonutf8.ics</ruri>
<verify>
<callback>prepostcondition</callback>
<arg>
<name>error</name>
<value>urn:ietf:params:xml:ns:caldavvalid-calendar-data</value>
</arg>
</verify>
</request>
</test>
<test name='3'>
<description>MOVE non-utf-8 data to calendar collection</description>
<request end-delete="yes">
<method>MOVE</method>
<header>
<name>Destination</name>
<value>$host:$calendarpath1:/copy1.ics</value>
</header>
<ruri>$pathprefix:/collection/nonutf8.ics</ruri>
<verify>
<callback>prepostcondition</callback>
<arg>
<name>error</name>
<value>urn:ietf:params:xml:ns:caldavvalid-calendar-data</value>
</arg>
</verify>
</request>
</test>
</test-suite>

<test-suite name="POSTs" ignore='no'>
<test name='1'>
<description>POST with non-utf-8 data</description>
<request print-response='no'>
<method>POST</method>
<header>
<name>Originator</name>
<value>$cuaddr1:</value>
</header>
<header>
<name>Recipient</name>
<value>$cuaddr2:, $cuaddr3:</value>
</header>
<ruri>$pathprefix:/$outbox:/</ruri>
<data>
<content-type>text/calendar; charset=utf-8</content-type>
<filepath>Resource/nonascii/11.ics</filepath>
</data>
<verify>
<callback>prepostcondition</callback>
<arg>
<name>error</name>
<value>urn:ietf:params:xml:ns:caldavvalid-calendar-data</value>
</arg>
</verify>
</request>
</test>
</test-suite>

<end/>

</caldavtest>

0 comments on commit 78a3e4d

Please sign in to comment.
You can’t perform that action at this time.