[CalendarServer-changes] [5884] CalendarServer/branches/new-store/twistedcaldav/test/test_mkcalendar .py

source_changes at macosforge.org source_changes at macosforge.org
Tue Jul 13 13:06:18 PDT 2010


Revision: 5884
          http://trac.macosforge.org/projects/calendarserver/changeset/5884
Author:   cdaboo at apple.com
Date:     2010-07-13 13:06:15 -0700 (Tue, 13 Jul 2010)
Log Message:
-----------
Don't use CalDAVFile - lookup the resource directly.

Modified Paths:
--------------
    CalendarServer/branches/new-store/twistedcaldav/test/test_mkcalendar.py

Modified: CalendarServer/branches/new-store/twistedcaldav/test/test_mkcalendar.py
===================================================================
--- CalendarServer/branches/new-store/twistedcaldav/test/test_mkcalendar.py	2010-07-13 18:48:25 UTC (rev 5883)
+++ CalendarServer/branches/new-store/twistedcaldav/test/test_mkcalendar.py	2010-07-13 20:06:15 UTC (rev 5884)
@@ -13,11 +13,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 ##
-from twisted.internet.defer import inlineCallbacks
-from twistedcaldav import index
 
 import os
 
+from twisted.internet.defer import inlineCallbacks
+
 from twext.web2 import responsecode
 from twext.web2.iweb import IResponse
 from twext.web2.stream import MemoryStream
@@ -26,7 +26,6 @@
 from twext.web2.test.test_server import SimpleRequest
 
 from twistedcaldav import caldavxml
-from twistedcaldav.static import CalDAVFile
 from twistedcaldav.test.util import HomeTestCase
 
 class MKCALENDAR (HomeTestCase):
@@ -47,24 +46,23 @@
         if os.path.exists(path):
             rmdir(path)
 
+        request = SimpleRequest(self.site, "MKCALENDAR", uri)
+
+        @inlineCallbacks
         def do_test(response):
             response = IResponse(response)
 
-            if not os.path.isdir(path):
-                self.fail("MKCALENDAR made no calendar")
-
-            resource = CalDAVFile(path)
-            if not resource.isCalendarCollection():
-                self.fail("MKCALENDAR made non-calendar collection")
-
             if response.code != responsecode.CREATED:
                 self.fail("Incorrect response to successful MKCALENDAR: %s"
                           % (response.code,))
+            resource = (yield request.locateResource(uri))
 
-            if not os.path.exists(os.path.join(path, index.db_basename)):
-                self.fail("Did not create index file when creating a calendar")
+            if not resource:
+                self.fail("MKCALENDAR made no calendar")
 
-        request = SimpleRequest(self.site, "MKCALENDAR", uri)
+            if not resource.isCalendarCollection():
+                self.fail("MKCALENDAR made non-calendar collection")
+
         return self.send(request, do_test)
 
     def test_make_calendar_with_props(self):
@@ -84,7 +82,7 @@
             if response.code != responsecode.CREATED:
                 self.fail("MKCALENDAR failed: %s" % (response.code,))
 
-            resource = CalDAVFile(path)
+            resource = (yield request.locateResource(uri))
             if not resource.isCalendarCollection():
                 self.fail("MKCALENDAR made non-calendar collection")
 
@@ -108,7 +106,7 @@
                           % (caldavxml.SupportedCalendarComponentSet.qname(),
                              supported_components[0].toxml(), caldavxml.CalendarComponent(name="VEVENT").toxml()))
 
-            tz = yield resource.readProperty(caldavxml.CalendarTimeZone, None)
+            tz = (yield resource.readProperty(caldavxml.CalendarTimeZone, None))
             tz = tz.calendar()
             self.failUnless(tz.resourceType() == "VTIMEZONE")
             self.failUnless(tuple(tz.subcomponents())[0].propertyValue("TZID") == "US-Eastern")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100713/a91b48fa/attachment.html>


More information about the calendarserver-changes mailing list