[CalendarServer-changes] [14033] CalDAVTester/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 1 03:18:32 PDT 2014


Revision: 14033
          http://trac.calendarserver.org//changeset/14033
Author:   cdaboo at apple.com
Date:     2014-10-01 03:18:32 -0700 (Wed, 01 Oct 2014)
Log Message:
-----------
Fixes for previous XML match changes.

Modified Paths:
--------------
    CalDAVTester/trunk/README.txt
    CalDAVTester/trunk/scripts/tests/CalDAV/calendaruserproxy.xml
    CalDAVTester/trunk/verifiers/xmlElementMatch.py

Modified: CalDAVTester/trunk/README.txt
===================================================================
--- CalDAVTester/trunk/README.txt	2014-09-30 16:48:38 UTC (rev 14032)
+++ CalDAVTester/trunk/README.txt	2014-10-01 10:18:32 UTC (rev 14033)
@@ -827,6 +827,7 @@
 	[^tag] - node has child element "tag".
 	[^tag=text] - node has child element "tag" with text "text".
 	[|] - node is empty.
+	[||] - node is not empty.
 	[json] - node contains valid JSON data.
 	[icalendar] - node contains valid iCalendare data.
 	

Modified: CalDAVTester/trunk/scripts/tests/CalDAV/calendaruserproxy.xml
===================================================================
--- CalDAVTester/trunk/scripts/tests/CalDAV/calendaruserproxy.xml	2014-09-30 16:48:38 UTC (rev 14032)
+++ CalDAVTester/trunk/scripts/tests/CalDAV/calendaruserproxy.xml	2014-10-01 10:18:32 UTC (rev 14033)
@@ -135,7 +135,7 @@
 	
 	<test-suite name='Group membership'>
 		<test name='1'>
-			<description>Verify no group memberships right now</description>
+			<description>Verify some group memberships right now</description>
 			<request>
 				<method>PROPFIND</method>
 				<ruri>$principal1:</ruri>
@@ -152,7 +152,7 @@
 					<arg>
 						<name>exists</name>
 						<value>$verify-property-prefix:/{DAV:}group-member-set[|]</value>
-						<value>$verify-property-prefix:/{DAV:}group-membership[|]</value>
+						<value>$verify-property-prefix:/{DAV:}group-membership[||]</value>
 					</arg>
 				</verify>
 			</request>
@@ -233,7 +233,7 @@
 			</request>
 		</test>
 		<test name='5'>
-			<description>Verify no group memberships right now</description>
+			<description>Verify some group memberships right now</description>
 			<request>
 				<method>PROPFIND</method>
 				<ruri>$principal1:</ruri>
@@ -250,7 +250,7 @@
 					<arg>
 						<name>exists</name>
 						<value>$verify-property-prefix:/{DAV:}group-member-set[|]</value>
-						<value>$verify-property-prefix:/{DAV:}group-membership[|]</value>
+						<value>$verify-property-prefix:/{DAV:}group-membership[||]</value>
 					</arg>
 				</verify>
 			</request>
@@ -348,7 +348,7 @@
 			</request>
 		</test>
 		<test name='10'>
-			<description>Verify no group memberships right now</description>
+			<description>Verify some group memberships right now</description>
 			<request>
 				<method>PROPFIND</method>
 				<ruri>$principal1:</ruri>
@@ -365,7 +365,7 @@
 					<arg>
 						<name>exists</name>
 						<value>$verify-property-prefix:/{DAV:}group-member-set[|]</value>
-						<value>$verify-property-prefix:/{DAV:}group-membership[|]</value>
+						<value>$verify-property-prefix:/{DAV:}group-membership[||]</value>
 					</arg>
 				</verify>
 			</request>
@@ -446,7 +446,7 @@
 			</request>
 		</test>
 		<test name='14'>
-			<description>Verify no group memberships right now</description>
+			<description>Verify some group memberships right now</description>
 			<request>
 				<method>PROPFIND</method>
 				<ruri>$principal1:</ruri>
@@ -463,7 +463,7 @@
 					<arg>
 						<name>exists</name>
 						<value>$verify-property-prefix:/{DAV:}group-member-set[|]</value>
-						<value>$verify-property-prefix:/{DAV:}group-membership[|]</value>
+						<value>$verify-property-prefix:/{DAV:}group-membership[||]</value>
 					</arg>
 				</verify>
 			</request>
@@ -590,7 +590,7 @@
 			</request>
 		</test>
 		<test name='21'>
-			<description>Verify no group memberships right now</description>
+			<description>Verify some group memberships right now</description>
 			<request>
 				<method>PROPFIND</method>
 				<ruri>$principal1:</ruri>
@@ -607,7 +607,7 @@
 					<arg>
 						<name>exists</name>
 						<value>$verify-property-prefix:/{DAV:}group-member-set[|]</value>
-						<value>$verify-property-prefix:/{DAV:}group-membership[|]</value>
+						<value>$verify-property-prefix:/{DAV:}group-membership[||]</value>
 					</arg>
 				</verify>
 			</request>
@@ -879,7 +879,7 @@
 					<arg>
 						<name>exists</name>
 						<value>$verify-property-prefix:/{http://calendarserver.org/ns/}calendar-proxy-read-for[|]</value>
-						<value>$verify-property-prefix:/{http://calendarserver.org/ns/}calendar-proxy-write-for[|]</value>
+						<value>$verify-property-prefix:/{http://calendarserver.org/ns/}calendar-proxy-write-for[||]</value>
 					</arg>
 				</verify>
 			</request>
@@ -985,7 +985,7 @@
 					<arg>
 						<name>exists</name>
 						<value>$verify-property-prefix:/{http://calendarserver.org/ns/}calendar-proxy-read-for[|]</value>
-						<value>$verify-property-prefix:/{http://calendarserver.org/ns/}calendar-proxy-write-for[|]</value>
+						<value>$verify-property-prefix:/{http://calendarserver.org/ns/}calendar-proxy-write-for[||]</value>
 					</arg>
 				</verify>
 			</request>

Modified: CalDAVTester/trunk/verifiers/xmlElementMatch.py
===================================================================
--- CalDAVTester/trunk/verifiers/xmlElementMatch.py	2014-09-30 16:48:38 UTC (rev 14032)
+++ CalDAVTester/trunk/verifiers/xmlElementMatch.py	2014-10-01 10:18:32 UTC (rev 14033)
@@ -111,42 +111,9 @@
             tests = [item[:-1] for item in tests.split('[')]
             for test in tests:
                 for node in nodes:
-                    if test[0] == '@':
-                        if '=' in test:
-                            attr, value = test[1:].split('=')
-                            value = value[1:-1]
-                        else:
-                            attr = test[1:]
-                            value = None
-                        if attr in node.keys() and (value is None or node.get(attr) == value):
-                            results.append(node)
-                    elif test[0] == '=':
-                        if node.text == test[1:]:
-                            results.append(node)
-                    elif test[0] == '!':
-                        if node.text != test[1:]:
-                            results.append(node)
-                    elif test[0] == '*':
-                        if node.text is not None and node.text.find(test[1:]) != -1:
-                            results.append(node)
-                    elif test[0] == '$':
-                        if node.text is not None and node.text.find(test[1:]) == -1:
-                            results.append(node)
-                    elif test[0] == '+':
-                        if node.text is not None and node.text.startswith(test[1:]):
-                            results.append(node)
-                    elif test[0] == '^':
-                        if "=" in test:
-                            element, value = test[1:].split("=", 1)
-                        else:
-                            element = test[1:]
-                            value = None
-                        for child in node.getchildren():
-                            if child.tag == element and (value is None or child.text == value):
-                                results.append(node)
-                    elif test[0] == '|':
-                        if node.text is None and len(node.getchildren()) == 0:
-                            results.append(node)
+                    testresult = self.testNode(node, path, test)
+                    if testresult is None:
+                        results.append(node)
         else:
             results = nodes
 
@@ -193,6 +160,13 @@
                     break
             else:
                 result = "        Missing child returned in XML for %s\n" % (node_path,)
+        elif test[0] == '|':
+            if len(test) == 2 and test[1] == "|":
+                if node.text is None and len(node.getchildren()) == 0:
+                    result = "        Empty element returned in XML for %s\n" % (node_path,)
+            else:
+                if node.text is not None or len(node.getchildren()) != 0:
+                    result = "        Non-empty element returned in XML for %s\n" % (node_path,)
 
         # Try to parse as iCalendar
         elif test == 'icalendar':
@@ -234,11 +208,11 @@
             actual_xpath = "./" + actual_xpath[3:]
 
         # Handle absolute root element and find all matching nodes
-        r = re.search("(/\{[^\}]+\}[^/]+|\.)(.*)", actual_xpath)
+        r = re.search("(/?\{[^\}]+\}[^/]+|\.)(.*)", actual_xpath)
         if r.group(2):
             root_path = r.group(1)
             child_path = r.group(2)[1:]
-            if root_path != "." and root.tag != root_path[1:]:
+            if root_path != "." and root.tag != root_path.lstrip("/"):
                 resulttxt += "        Items not returned in XML for %s\n" % (title,)
                 result = False
                 return result, resulttxt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20141001/52a1faa7/attachment-0001.html>


More information about the calendarserver-changes mailing list