[CalendarServer-changes] [5998] CalendarServer/branches/users/glyph/sql-store/twistedcaldav/test/ test_wrapping.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Aug 6 10:39:55 PDT 2010


Revision: 5998
          http://trac.macosforge.org/projects/calendarserver/changeset/5998
Author:   glyph at apple.com
Date:     2010-08-06 10:39:54 -0700 (Fri, 06 Aug 2010)
Log Message:
-----------
add basic integration tests for DB backend

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

Modified: CalendarServer/branches/users/glyph/sql-store/twistedcaldav/test/test_wrapping.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/twistedcaldav/test/test_wrapping.py	2010-08-06 17:39:37 UTC (rev 5997)
+++ CalendarServer/branches/users/glyph/sql-store/twistedcaldav/test/test_wrapping.py	2010-08-06 17:39:54 UTC (rev 5998)
@@ -19,10 +19,12 @@
 """
 
 
+from twisted.trial.unittest import SkipTest
+
 from twext.web2.server import Request
 from twext.web2.responsecode import UNAUTHORIZED
 from twext.web2.http_headers import Headers
-from txdav.idav import AlreadyFinishedError
+from txdav.idav import AlreadyFinishedError, IDataStore
 
 from twext.web2.dav import davxml
 from twistedcaldav.config import config
@@ -37,13 +39,18 @@
 
 from twistedcaldav.test.util import TestCase
 
-from txcaldav.calendarstore.file import CalendarStore, CalendarHome
 from txcaldav.calendarstore.test.test_file import event4_text
 
 from txcarddav.addressbookstore.file import AddressBookStore, AddressBookHome
 from txcarddav.addressbookstore.test.test_file import vcard4_text
 
+from txcaldav.calendarstore.test.test_postgres import buildStore
+from txcaldav.calendarstore.test.common import StubNotifierFactory, \
+    assertProvides
+from txcaldav.icalendarstore import ICalendarHome
 
+
+
 class FakeChanRequest(object):
     def writeHeaders(self, code, headers):
         self.code = code
@@ -65,7 +72,6 @@
 
 
 
-
 class WrappingTests(TestCase):
     """
     Tests for L{twistedcaldav.static.CalDAVFile} creating the appropriate type
@@ -188,6 +194,9 @@
         return req
 
 
+    pathTypes = ['calendar', 'addressbook']
+
+
     @inlineCallbacks
     def test_autoRevertUnCommitted(self):
         """
@@ -196,7 +205,7 @@
         commit them.  This can happen, for example, with resources that are
         children of non-existent (proto-)resources.
         """
-        for pathType in ['calendar', 'addressbook']:
+        for pathType in self.pathTypes:
             req = self.requestForPath('/%ss/users/wsanchez/%s/forget/it'
                                       % (pathType, pathType))
             yield req.process()
@@ -211,7 +220,7 @@
         Sanity check and integration test: an unauthorized request of calendar
         and addressbook resources results in an L{UNAUTHORIZED} response code.
         """
-        for pathType in ['calendar', 'addressbook']:
+        for pathType in self.pathTypes:
             req = self.requestForPath('/%ss/users/wsanchez/%s/'
                                       % (pathType, pathType))
             yield req.process()
@@ -223,7 +232,7 @@
         Creating a DirectoryCalendarHomeProvisioningResource will create a paired
         CalendarStore.
         """
-        self.assertIsInstance(self.calendarCollection._newStore, CalendarStore)
+        assertProvides(self, IDataStore, self.calendarCollection._newStore)
 
 
     @inlineCallbacks
@@ -235,7 +244,7 @@
         """
         calDavFile = yield self.getResource("calendars/users/wsanchez/")
         self.commit()
-        self.assertIsInstance(calDavFile._newStoreHome, CalendarHome)
+        assertProvides(self, ICalendarHome, calDavFile._newStoreHome)
 
 
     @inlineCallbacks
@@ -412,3 +421,30 @@
         self.commit()
         self.assertEquals(calDavFileAddressBook._principalCollections,
                           frozenset([self.principalsResource]))
+
+
+
+class DatabaseWrappingTests(WrappingTests):
+
+    @inlineCallbacks
+    def setUp(self):
+        self.calendarStore = yield buildStore(self, StubNotifierFactory())
+        super(DatabaseWrappingTests, self).setUp()
+
+
+    def createDataStore(self):
+        return self.calendarStore
+
+
+    def noTest(self):
+        raise SkipTest("no addressbooks yet")
+
+    pathTypes = ['calendar']
+
+    test_createAddressBookStore = noTest
+    test_lookupExistingAddressBook = noTest
+    test_lookupNewAddressBook = noTest
+    test_lookupNewAddressBookObject = noTest
+    test_lookupAddressBookObject = noTest
+    test_lookupAddressBookHome = noTest
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100806/8178a9bc/attachment-0001.html>


More information about the calendarserver-changes mailing list