[CalendarServer-changes] [2774] CalDAVTester/branches/users/cdaboo/implicit-2661/verifiers/ propfindItems.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 6 10:02:23 PDT 2008


Revision: 2774
          http://trac.macosforge.org/projects/calendarserver/changeset/2774
Author:   cdaboo at apple.com
Date:     2008-08-06 10:02:22 -0700 (Wed, 06 Aug 2008)
Log Message:
-----------
Test that counts how many items were returned in a PROPFIND response.

Modified Paths:
--------------
    CalDAVTester/branches/users/cdaboo/implicit-2661/verifiers/propfindItems.py

Modified: CalDAVTester/branches/users/cdaboo/implicit-2661/verifiers/propfindItems.py
===================================================================
--- CalDAVTester/branches/users/cdaboo/implicit-2661/verifiers/propfindItems.py	2008-08-05 20:52:06 UTC (rev 2773)
+++ CalDAVTester/branches/users/cdaboo/implicit-2661/verifiers/propfindItems.py	2008-08-06 17:02:22 UTC (rev 2774)
@@ -30,9 +30,16 @@
     
     def verify(self, manager, uri, response, respdata, args): #@UnusedVariable
 
-        # If no status veriffication requested, then assume all 2xx codes are OK
+        # If no status verification requested, then assume all 2xx codes are OK
         ignores = args.get("ignore", [])
 
+        # Check how many responses are returned
+        counts = args.get("count", [])
+        if len(counts) == 1:
+            count = int(counts[0])
+        else:
+            count = None
+
         # Get property arguments and split on $ delimited for name, value tuples
         okprops = args.get("okprops", [])
         ok_props_match = []
@@ -73,10 +80,11 @@
         try:
             doc = xml.dom.minidom.parseString( respdata )
         except:
-            return False, "           Coluld not parse proper XML response\n"
+            return False, "           Could not parse proper XML response\n"
                 
         result = True
         resulttxt = ""
+        ctr = 0
         for response in doc.getElementsByTagNameNS( "DAV:", "response" ):
 
             # Get href for this response
@@ -89,6 +97,10 @@
                 href = ""
             if href in ignores:
                 continue
+            
+            if count is not None:
+                ctr += 1
+                continue
 
             # Get all property status
             ok_status_props = []
@@ -175,5 +187,9 @@
                         resulttxt += " " + str(i) 
                     resulttxt += "\n"
                 result = False
-            
+        
+        if count is not None and count != ctr:
+            result = False
+            resulttxt = "        Expected %d response items but got %d." % (count, ctr,)
+
         return result, resulttxt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080806/9af3ecf2/attachment.html 


More information about the calendarserver-changes mailing list