[CalendarServer-changes] [6053] CalendarServer/branches/users/glyph/sql-store/twistedcaldav/test/ test_collectioncontents.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 11 09:58:09 PDT 2010


Revision: 6053
          http://trac.macosforge.org/projects/calendarserver/changeset/6053
Author:   glyph at apple.com
Date:     2010-08-11 09:58:09 -0700 (Wed, 11 Aug 2010)
Log Message:
-----------
do test serially, since doing it in parallel reuses an existing transaction in invalid ways

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/sql-store/twistedcaldav/test/test_collectioncontents.py

Modified: CalendarServer/branches/users/glyph/sql-store/twistedcaldav/test/test_collectioncontents.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/twistedcaldav/test/test_collectioncontents.py	2010-08-11 16:48:09 UTC (rev 6052)
+++ CalendarServer/branches/users/glyph/sql-store/twistedcaldav/test/test_collectioncontents.py	2010-08-11 16:58:09 UTC (rev 6053)
@@ -14,7 +14,7 @@
 # limitations under the License.
 ##
 
-from twisted.internet.defer import DeferredList
+from twisted.internet.defer import inlineCallbacks
 from twext.python.filepath import CachingFilePath as FilePath
 from twext.web2 import responsecode
 from twext.web2.iweb import IResponse
@@ -65,9 +65,7 @@
         """
         Make (regular) collection in calendar
         """
-        calendar_path, calendar_uri = self.mkdtemp("collection_in_calendar")
-        calPath = FilePath(calendar_path)
-        calPath.remove()
+        calendar_uri = "/collection_in_calendar/"
 
         def mkcalendar_cb(response):
             response = IResponse(response)
@@ -166,35 +164,33 @@
         with the data from given stream and verifies that the response code from the
         PUT request matches the given response_code.
         """
-        ignored, calendar_uri = self.mkdtemp("calendar")
+        calendar_uri = "/testing_calendar/"
 
+
+        @inlineCallbacks
         def mkcalendar_cb(response):
             response = IResponse(response)
 
             if response.code != responsecode.CREATED:
                 self.fail("MKCALENDAR failed: %s" % (response.code,))
 
-            ds = []
             c = 0
 
             for stream, response_code in work:
-                def put_cb(response, stream=stream, response_code=response_code):
-                    response = IResponse(response)
 
-                    if response.code != response_code:
-                        self.fail("Incorrect response to %s: %s (!= %s)" % (what, response.code, response_code))
-
                 dst_uri = "/".join([calendar_uri, "dst%d.ics" % (c,)])
                 request = SimpleRequest(self.site, "PUT", dst_uri)
                 request.headers.setHeader("if-none-match", "*")
                 request.headers.setHeader("content-type", MimeType("text", "calendar"))
                 request.stream = stream
-                ds.append(self.send(request, put_cb))
+                response = yield self.send(request)
+                response = IResponse(response)
 
+                if response.code != response_code:
+                    self.fail("Incorrect response to %s: %s (!= %s)" % (what, response.code, response_code))
+
                 c += 1
 
-            return DeferredList(ds)
-
         request = SimpleRequest(self.site, "MKCALENDAR", calendar_uri)
         return self.send(request, mkcalendar_cb)
 
@@ -203,7 +199,7 @@
         """
         Make (regular) collection in calendar
         """
-        ignored, calendar_uri = self.mkdtemp("dot_file_in_calendar")
+        calendar_uri = "/dot_file_in_calendar/"
 
         def mkcalendar_cb(response):
             response = IResponse(response)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100811/fba82400/attachment-0001.html>


More information about the calendarserver-changes mailing list