[CalendarServer-changes] [13997] CalDAVTester/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Sep 23 12:22:09 PDT 2014
Revision: 13997
http://trac.calendarserver.org//changeset/13997
Author: cdaboo at apple.com
Date: 2014-09-23 12:22:09 -0700 (Tue, 23 Sep 2014)
Log Message:
-----------
Test that trying to unshare with the owner of a shared calendar fails properly.
Modified Paths:
--------------
CalDAVTester/trunk/scripts/tests/CalDAV/json.xml
CalDAVTester/trunk/scripts/tests/CalDAV/sharing-unshare.xml
CalDAVTester/trunk/src/request.py
CalDAVTester/trunk/verifiers/xmlElementMatch.py
Added Paths:
-----------
CalDAVTester/trunk/Resource/CalDAV/sharing/unshare/self-error/
CalDAVTester/trunk/Resource/CalDAV/sharing/unshare/self-error/1.xml
CalDAVTester/trunk/Resource/Common/POST/sharing-invite1.xml
CalDAVTester/trunk/Resource/Common/POST/sharing-remove1.xml
Added: CalDAVTester/trunk/Resource/CalDAV/sharing/unshare/self-error/1.xml
===================================================================
--- CalDAVTester/trunk/Resource/CalDAV/sharing/unshare/self-error/1.xml (rev 0)
+++ CalDAVTester/trunk/Resource/CalDAV/sharing/unshare/self-error/1.xml 2014-09-23 19:22:09 UTC (rev 13997)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<CS:share xmlns:D="DAV:" xmlns:CS="http://calendarserver.org/ns/">
+ <CS:remove>
+ <D:href>$cuaddr1:</D:href>
+ <CS:summary>My Shared Calendar</CS:summary>
+ <CS:read-write/>
+ </CS:remove>
+</CS:share>
Added: CalDAVTester/trunk/Resource/Common/POST/sharing-invite1.xml
===================================================================
--- CalDAVTester/trunk/Resource/Common/POST/sharing-invite1.xml (rev 0)
+++ CalDAVTester/trunk/Resource/Common/POST/sharing-invite1.xml 2014-09-23 19:22:09 UTC (rev 13997)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<CS:share xmlns:D="DAV:" xmlns:CS="http://calendarserver.org/ns/">
+ <CS:set>
+ <D:href>$sharee:</D:href>
+ <CS:summary>My Shared Calendar</CS:summary>
+ <CS:read-write/>
+ </CS:set>
+</CS:share>
Added: CalDAVTester/trunk/Resource/Common/POST/sharing-remove1.xml
===================================================================
--- CalDAVTester/trunk/Resource/Common/POST/sharing-remove1.xml (rev 0)
+++ CalDAVTester/trunk/Resource/Common/POST/sharing-remove1.xml 2014-09-23 19:22:09 UTC (rev 13997)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<CS:share xmlns:D="DAV:" xmlns:CS="http://calendarserver.org/ns/">
+ <CS:remove>
+ <D:href>$sharee:</D:href>
+ <CS:read-write/>
+ </CS:remove>
+</CS:share>
Modified: CalDAVTester/trunk/scripts/tests/CalDAV/json.xml
===================================================================
--- CalDAVTester/trunk/scripts/tests/CalDAV/json.xml 2014-09-22 21:46:13 UTC (rev 13996)
+++ CalDAVTester/trunk/scripts/tests/CalDAV/json.xml 2014-09-23 19:22:09 UTC (rev 13997)
@@ -590,10 +590,10 @@
<callback>xmlElementMatch</callback>
<arg>
<name>exists</name>
- <value>{$CALDAV}schedule-response/{$CALDAV:}response/{$CALDAV:}calendar-data[@content-type="application/calendar+json"]</value>
- <value>{$CALDAV}schedule-response/{$CALDAV:}response/{$CALDAV:}calendar-data[json]</value>
- <value>{$CALDAV}schedule-response/{$CALDAV:}response/{$CALDAV:}calendar-data[*vcalendar]</value>
- <value>{$CALDAV}schedule-response/{$CALDAV:}response/{$CALDAV:}calendar-data[*vfreebusy]</value>
+ <value>{$CALDAV:}schedule-response/{$CALDAV:}response/{$CALDAV:}calendar-data[@content-type="application/calendar+json"]</value>
+ <value>{$CALDAV:}schedule-response/{$CALDAV:}response/{$CALDAV:}calendar-data[json]</value>
+ <value>{$CALDAV:}schedule-response/{$CALDAV:}response/{$CALDAV:}calendar-data[*vcalendar]</value>
+ <value>{$CALDAV:}schedule-response/{$CALDAV:}response/{$CALDAV:}calendar-data[*vfreebusy]</value>
</arg>
</verify>
</request>
Modified: CalDAVTester/trunk/scripts/tests/CalDAV/sharing-unshare.xml
===================================================================
--- CalDAVTester/trunk/scripts/tests/CalDAV/sharing-unshare.xml 2014-09-22 21:46:13 UTC (rev 13996)
+++ CalDAVTester/trunk/scripts/tests/CalDAV/sharing-unshare.xml 2014-09-23 19:22:09 UTC (rev 13997)
@@ -484,6 +484,187 @@
</request>
</test>
</test-suite>
+
+ <test-suite name='Self uninvite error'>
+ <test name='1'>
+ <description>POST invitation</description>
+ <request>
+ <method>POST</method>
+ <ruri>$calendarhome1:/shared/</ruri>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/POST/sharing-invite1.xml</filepath>
+ <substitute>
+ <name>$sharee:</name>
+ <value>$cuaddr2:</value>
+ </substitute>
+ </data>
+ <verify>
+ <callback>statusCode</callback>
+ </verify>
+ </request>
+ </test>
+ <test name='2'>
+ <description>Check Sharee notification collection</description>
+ <request user="$userid2:" pswd="$pswd2:">
+ <method>WAITCOUNT 1</method>
+ <ruri>$notificationpath2:/</ruri>
+ </request>
+ <request user="$userid2:" pswd="$pswd2:">
+ <method>GETNEW</method>
+ <ruri>$notificationpath2:/</ruri>
+ <verify>
+ <callback>xmlElementMatch</callback>
+ <arg>
+ <name>exists</name>
+ <value>/{$CS:}notification/{$CS:}invite-notification/{DAV:}href[=$cuaddrurn2:]</value>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>{$CS:}invite-notification/{$CS:}uid</name>
+ <variable>$inviteuid2:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='3'>
+ <description>Sharee replies ACCEPTED</description>
+ <request user="$userid2:" pswd="$pswd2:">
+ <method>POST</method>
+ <ruri>$calendarhome2:/</ruri>
+ <data>
+ <content-type>application/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/POST/sharingreply2.xml</filepath>
+ </data>
+ <verify>
+ <callback>xmlElementMatch</callback>
+ <arg>
+ <name>exists</name>
+ <value>/{$CS:}shared-as/{DAV:}href</value>
+ </arg>
+ </verify>
+ <grabelement>
+ <name>{DAV:}href</name>
+ <variable>$shareecalendar:</variable>
+ </grabelement>
+ </request>
+ </test>
+ <test name='4'>
+ <description>POST removal of owner</description>
+ <request>
+ <method>POST</method>
+ <ruri>$calendarhome1:/shared/</ruri>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/CalDAV/sharing/unshare/self-error/1.xml</filepath>
+ </data>
+ <verify>
+ <callback>statusCode</callback>
+ </verify>
+ </request>
+ </test>
+ <test name='5'>
+ <description>Owner calendar still present</description>
+ <request>
+ <method>PROPFIND</method>
+ <ruri>$calendarhome1:/shared/</ruri>
+ <header>
+ <name>Depth</name>
+ <value>0</value>
+ </header>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/PROPFIND/resourcetype.xml</filepath>
+ </data>
+ <verify>
+ <callback>xmlElementMatch</callback>
+ <arg>
+ <name>exists</name>
+ <value>$verify-property-prefix:/{DAV:}resourcetype</value>
+ </arg>
+ </verify>
+ </request>
+ </test>
+ <test name='6'>
+ <description>Sharee calendar still present</description>
+ <request user="$userid2:" pswd="$pswd2:">
+ <method>PROPFIND</method>
+ <ruri>$shareecalendar:/</ruri>
+ <header>
+ <name>Depth</name>
+ <value>0</value>
+ </header>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/PROPFIND/resourcetype.xml</filepath>
+ </data>
+ <verify>
+ <callback>xmlElementMatch</callback>
+ <arg>
+ <name>exists</name>
+ <value>$verify-property-prefix:/{DAV:}resourcetype</value>
+ </arg>
+ </verify>
+ </request>
+ </test>
+ <test name='7'>
+ <description>POST uninvitation</description>
+ <request>
+ <method>POST</method>
+ <ruri>$calendarhome1:/shared/</ruri>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/POST/sharing-remove1.xml</filepath>
+ <substitute>
+ <name>$sharee:</name>
+ <value>$cuaddr2:</value>
+ </substitute>
+ </data>
+ <verify>
+ <callback>statusCode</callback>
+ </verify>
+ </request>
+ </test>
+ <test name='8'>
+ <description>Check Sharee notification collection</description>
+ <request user="$userid2:" pswd="$pswd2:">
+ <method>WAITCOUNT 1</method>
+ <ruri>$notificationpath2:/</ruri>
+ </request>
+ <request user="$userid2:" pswd="$pswd2:">
+ <method>GETNEW</method>
+ <ruri>$notificationpath2:/</ruri>
+ <verify>
+ <callback>xmlElementMatch</callback>
+ <arg>
+ <name>exists</name>
+ <value>/{$CS:}notification/{$CS:}invite-notification/{DAV:}href[=$cuaddrurn2:]</value>
+ </arg>
+ </verify>
+ </request>
+ </test>
+ <test name='9'>
+ <description>Sharee calendar still present</description>
+ <request user="$userid2:" pswd="$pswd2:">
+ <method>PROPFIND</method>
+ <ruri>$shareecalendar:/</ruri>
+ <header>
+ <name>Depth</name>
+ <value>0</value>
+ </header>
+ <data>
+ <content-type>text/xml; charset=utf-8</content-type>
+ <filepath>Resource/Common/PROPFIND/resourcetype.xml</filepath>
+ </data>
+ <verify>
+ <callback>statusCode</callback>
+ <arg>
+ <name>status</name>
+ <value>404</value>
+ </arg>
+ </verify>
+ </request>
+ </test>
+ </test-suite>
<end>
<request user="$useradmin:" pswd="$pswdadmin:">
Modified: CalDAVTester/trunk/src/request.py
===================================================================
--- CalDAVTester/trunk/src/request.py 2014-09-22 21:46:13 UTC (rev 13996)
+++ CalDAVTester/trunk/src/request.py 2014-09-23 19:22:09 UTC (rev 13997)
@@ -439,7 +439,7 @@
variable = None
for child in node.getchildren():
if child.tag in (src.xmlDefs.ELEMENT_NAME, src.xmlDefs.ELEMENT_PROPERTY):
- name = child.text.encode("utf-8")
+ name = self.manager.server_info.subs(child.text.encode("utf-8"))
elif child.tag == src.xmlDefs.ELEMENT_VARIABLE:
variable = self.manager.server_info.subs(child.text.encode("utf-8"))
Modified: CalDAVTester/trunk/verifiers/xmlElementMatch.py
===================================================================
--- CalDAVTester/trunk/verifiers/xmlElementMatch.py 2014-09-22 21:46:13 UTC (rev 13996)
+++ CalDAVTester/trunk/verifiers/xmlElementMatch.py 2014-09-23 19:22:09 UTC (rev 13997)
@@ -22,6 +22,7 @@
from pycalendar.icalendar.calendar import Calendar
from xml.etree.cElementTree import ElementTree
import json
+import re
import StringIO
class Verifier(object):
@@ -89,8 +90,10 @@
# Handle absolute root element
if actual_path[0] == '/':
actual_path = actual_path[1:]
- if '/' in actual_path:
- root_path, child_path = actual_path.split('/', 1)
+ r = re.search("(\{[^\}]+\}[^/]+)(.*)", actual_path)
+ if r.group(2):
+ root_path = r.group(1)
+ child_path = r.group(2)[1:]
if root.tag != root_path:
return None
nodes = root.findall(child_path)
@@ -164,10 +167,14 @@
# Handle absolute root element
if actual_path[0] == '/':
actual_path = actual_path[1:]
- if '/' in actual_path:
- root_path, child_path = actual_path.split('/', 1)
+ r = re.search("(\{[^\}]+\}[^/]+)(.*)", actual_path)
+ if r.group(2):
+ root_path = r.group(1)
+ child_path = r.group(2)[1:]
if root.tag != root_path:
resulttxt += " Items not returned in XML for %s\n" % (path,)
+ result = False
+ return result, resulttxt
nodes = root.findall(child_path)
else:
nodes = (root,)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140923/66109c5c/attachment-0001.html>
More information about the calendarserver-changes
mailing list