[CalendarServer-changes] [6375] CalendarServer/branches/users/glyph/more-deferreds-7/txdav/carddav/ datastore/test
source_changes at macosforge.org
source_changes at macosforge.org
Fri Sep 24 11:11:14 PDT 2010
Revision: 6375
http://trac.macosforge.org/projects/calendarserver/changeset/6375
Author: glyph at apple.com
Date: 2010-09-24 11:11:13 -0700 (Fri, 24 Sep 2010)
Log Message:
-----------
addressBookObjects
Modified Paths:
--------------
CalendarServer/branches/users/glyph/more-deferreds-7/txdav/carddav/datastore/test/common.py
CalendarServer/branches/users/glyph/more-deferreds-7/txdav/carddav/datastore/test/test_file.py
CalendarServer/branches/users/glyph/more-deferreds-7/txdav/carddav/datastore/test/test_sql.py
Modified: CalendarServer/branches/users/glyph/more-deferreds-7/txdav/carddav/datastore/test/common.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-7/txdav/carddav/datastore/test/common.py 2010-09-24 16:25:14 UTC (rev 6374)
+++ CalendarServer/branches/users/glyph/more-deferreds-7/txdav/carddav/datastore/test/common.py 2010-09-24 18:11:13 UTC (rev 6375)
@@ -384,7 +384,7 @@
in the filesystem, in name order, but skip those with hidden names.
"""
addressbook1 = yield self.addressbookUnderTest()
- addressbookObjects = list(addressbook1.addressbookObjects())
+ addressbookObjects = list((yield addressbook1.addressbookObjects()))
for addressbookObject in addressbookObjects:
self.assertProvides(IAddressBookObject, addressbookObject)
@@ -408,7 +408,7 @@
"""
addressbook1 = yield self.addressbookUnderTest()
addressbook1.removeAddressBookObjectWithName("2.vcf")
- addressbookObjects = list(addressbook1.addressbookObjects())
+ addressbookObjects = list((yield addressbook1.addressbookObjects()))
self.assertEquals(set(o.name() for o in addressbookObjects),
set(addressbook1_objectNames) - set(["2.vcf"]))
Modified: CalendarServer/branches/users/glyph/more-deferreds-7/txdav/carddav/datastore/test/test_file.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-7/txdav/carddav/datastore/test/test_file.py 2010-09-24 16:25:14 UTC (rev 6374)
+++ CalendarServer/branches/users/glyph/more-deferreds-7/txdav/carddav/datastore/test/test_file.py 2010-09-24 18:11:13 UTC (rev 6375)
@@ -193,8 +193,8 @@
self.home1.createAddressBookWithName("addressbook2")
addressbook = self.home1.addressbookWithName("addressbook2")
index = addressbook._index
- self.assertEquals(set(index.addressbookObjects()),
- set(addressbook.addressbookObjects()))
+ self.assertEquals(set((yield index.addressbookObjects())),
+ set((yield addressbook.addressbookObjects())))
yield self.txn.commit()
self.txn = self.addressbookStore.newTransaction(self.id())
self.home1 = yield self.txn.addressbookHomeWithUID("home1")
@@ -204,8 +204,8 @@
# test would be more effective if there were actually some objects in
# this list.
index = addressbook._index
- self.assertEquals(set(index.addressbookObjects()),
- set(addressbook.addressbookObjects()))
+ self.assertEquals(set((yield index.addressbookObjects())),
+ set((yield addressbook.addressbookObjects())))
def test_addressbookObjectWithName_dot(self):
@@ -460,11 +460,12 @@
self.storeRootPath)
+ @inlineCallbacks
def test_addressbookObjectsWithDotFile(self):
"""
Adding a dotfile to the addressbook home should not create a new
addressbook object.
"""
self.homeUnderTest()._path.child(".foo").createDirectory()
- self.test_addressbookObjects()
+ yield self.test_addressbookObjects()
Modified: CalendarServer/branches/users/glyph/more-deferreds-7/txdav/carddav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-7/txdav/carddav/datastore/test/test_sql.py 2010-09-24 16:25:14 UTC (rev 6374)
+++ CalendarServer/branches/users/glyph/more-deferreds-7/txdav/carddav/datastore/test/test_sql.py 2010-09-24 18:11:13 UTC (rev 6375)
@@ -31,7 +31,7 @@
from txdav.carddav.datastore.util import _migrateAddressbook, migrateHome
from twisted.trial import unittest
-from twisted.internet.defer import inlineCallbacks
+from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet.threads import deferToThread
from twistedcaldav.vcard import Component as VCard
@@ -80,19 +80,23 @@
return self._sqlStore
+ @inlineCallbacks
def assertAddressbooksSimilar(self, a, b, bAddressbookFilter=None):
"""
Assert that two addressbooks have a similar structure (contain the same
events).
"""
+ @inlineCallbacks
def namesAndComponents(x, filter=lambda x:x.component()):
- return dict([(fromObj.name(), filter(fromObj))
- for fromObj in x.addressbookObjects()])
+ fromObjs = yield x.addressbookObjects()
+ returnValue(dict([(fromObj.name(), filter(fromObj))
+ for fromObj in fromObjs]))
if bAddressbookFilter is not None:
extra = [bAddressbookFilter]
else:
extra = []
- self.assertEquals(namesAndComponents(a), namesAndComponents(b, *extra))
+ self.assertEquals((yield namesAndComponents(a)),
+ (yield namesAndComponents(b, *extra)))
def assertPropertiesSimilar(self, a, b, disregard=[]):
@@ -135,7 +139,7 @@
toAddressbook = yield toHome.addressbookWithName("addressbook")
_migrateAddressbook(fromAddressbook, toAddressbook,
lambda x: x.component())
- self.assertAddressbooksSimilar(fromAddressbook, toAddressbook)
+ yield self.assertAddressbooksSimilar(fromAddressbook, toAddressbook)
@inlineCallbacks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100924/4c9c9f49/attachment-0001.html>
More information about the calendarserver-changes
mailing list