[CalendarServer-changes] [10859] CalendarServer/branches/users/gaya/sharedgroups/txdav

source_changes at macosforge.org source_changes at macosforge.org
Tue Mar 5 16:41:58 PST 2013


Revision: 10859
          http://trac.calendarserver.org//changeset/10859
Author:   gaya at apple.com
Date:     2013-03-05 16:41:58 -0800 (Tue, 05 Mar 2013)
Log Message:
-----------
Fix most migration tests

Modified Paths:
--------------
    CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py
    CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/test/test_sql.py
    CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/upgrade/test/test_migrate.py

Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py	2013-03-05 23:33:58 UTC (rev 10858)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py	2013-03-06 00:41:58 UTC (rev 10859)
@@ -55,7 +55,7 @@
     _BIND_MODE_OWN, _BIND_MODE_WRITE, _BIND_STATUS_ACCEPTED, \
     _BIND_STATUS_DECLINED, _BIND_STATUS_INVITED
 from txdav.common.icommondatastore import HomeChildNameNotAllowedError, \
-    HomeChildNameAlreadyExistsError, InternalDataStoreError
+    InternalDataStoreError
 from txdav.xml.rfc2518 import ResourceType
 
 from zope.interface.declarations import implements
@@ -326,7 +326,9 @@
     @inlineCallbacks
     def create(cls, home, name):
         if name == home.addressbookName():
-            raise HomeChildNameAlreadyExistsError
+            #raise HomeChildNameAlreadyExistsError
+            yield None
+            pass
         else:
             raise HomeChildNameNotAllowedError
 
@@ -392,14 +394,11 @@
 
     @inlineCallbacks
     def ownerAddressBook(self):
-        if not hasattr(self, "_ownerAddressBook"):
-            if self.owned():
-                yield None
-                self._ownerAddressBook = self
-            else:
-                ownerHome = yield self.ownerAddressBookHome()
-                self._ownerAddressBook = yield ownerHome.addressbook()
-        returnValue(self._ownerAddressBook)
+        if self.owned():
+            yield None
+            returnValue(self)
+        else:
+            returnValue((yield self.ownerAddressBookHome().addressbook()))
 
 
     @classmethod

Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/test/test_sql.py	2013-03-05 23:33:58 UTC (rev 10858)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/test/test_sql.py	2013-03-06 00:41:58 UTC (rev 10859)
@@ -144,7 +144,7 @@
         database- backed addressbook.
         """
         fromAddressbook = yield self.fileTransaction().addressbookHomeWithUID(
-            "home1").addressbookWithName("addressbook_1")
+            "home1").addressbookWithName("addressbook")
         toHome = yield self.transactionUnderTest().addressbookHomeWithUID(
             "new-home", create=True)
         toAddressbook = yield toHome.addressbookWithName("addressbook")
@@ -162,7 +162,7 @@
         is "bad" address data present in the file-backed addressbook.
         """
         fromAddressbook = yield self.fileTransaction().addressbookHomeWithUID(
-            "home_bad").addressbookWithName("addressbook_bad")
+            "home_bad").addressbookWithName("addressbook")
         toHome = yield self.transactionUnderTest().addressbookHomeWithUID(
             "new-home", create=True)
         toAddressbook = yield toHome.addressbookWithName("addressbook")
@@ -189,7 +189,7 @@
 
         key = PropertyName.fromElement(GETContentLanguage)
         fromHome.properties()[key] = GETContentLanguage("C")
-        (yield fromHome.addressbookWithName("addressbook_1")).properties()[
+        (yield fromHome.addressbookWithName("addressbook")).properties()[
             key] = (
             GETContentLanguage("pig-latin")
         )

Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/upgrade/test/test_migrate.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/upgrade/test/test_migrate.py	2013-03-05 23:33:58 UTC (rev 10858)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/upgrade/test/test_migrate.py	2013-03-06 00:41:58 UTC (rev 10859)
@@ -45,14 +45,7 @@
 from txdav.common.datastore.upgrade.migrate import UpgradeToDatabaseService, \
     StoreSpawnerService, swapAMP
 
-import copy
-def _todo(f, why):
-    f.todo = why
-    return f
-rewriteOrRemove = lambda f: _todo(f, "Rewrite or remove")
 
-
-
 class CreateStore(Command):
     """
     Create a store in a subprocess.
@@ -382,7 +375,6 @@
 
 
     @inlineCallbacks
-    @rewriteOrRemove
     def test_upgradeAddressBookHomes(self):
         """
         L{UpgradeToDatabaseService.startService} will do the upgrade, then
@@ -404,7 +396,7 @@
 
         # Want metadata preserved
         home = (yield txn.addressbookHomeWithUID("home1"))
-        adbk = (yield home.addressbookWithName("addressbook_1"))
+        adbk = (yield home.addressbookWithName("addressbook"))
         for name, md5 in (
             ("1.vcf", ABCommonTests.md5Values[0]),
             ("2.vcf", ABCommonTests.md5Values[1]),
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130305/e9b6ae1f/attachment-0001.html>


More information about the calendarserver-changes mailing list