[CalendarServer-changes] [6349] CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/ datastore/test/common.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Sep 22 21:52:58 PDT 2010
Revision: 6349
http://trac.macosforge.org/projects/calendarserver/changeset/6349
Author: glyph at apple.com
Date: 2010-09-22 21:52:57 -0700 (Wed, 22 Sep 2010)
Log Message:
-----------
yields on all commits
Modified Paths:
--------------
CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/datastore/test/common.py
Modified: CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/datastore/test/common.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/datastore/test/common.py 2010-09-23 04:51:35 UTC (rev 6348)
+++ CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/datastore/test/common.py 2010-09-23 04:52:57 UTC (rev 6349)
@@ -17,6 +17,7 @@
"""
Tests for common addressbook store API functions.
"""
+from twisted.internet.defer import inlineCallbacks
from txdav.idav import IPropertyStore, IDataStore
from txdav.base.propertystore.base import PropertyName
@@ -239,6 +240,7 @@
self.assertEquals(addressbook.name(), name)
+ @inlineCallbacks
def test_addressbookRename(self):
"""
L{IAddressBook.rename} changes the name of the L{IAddressBook}.
@@ -251,7 +253,7 @@
self.assertEquals(addressbook, home.addressbookWithName("some_other_name"))
self.assertEquals(None, home.addressbookWithName("addressbook_1"))
positiveAssertions()
- self.commit()
+ yield self.commit()
home = self.homeUnderTest()
addressbook = home.addressbookWithName("some_other_name")
positiveAssertions()
@@ -269,6 +271,7 @@
None)
+ @inlineCallbacks
def test_createAddressBookWithName_absent(self):
"""
L{IAddressBookHome.createAddressBookWithName} creates a new L{IAddressBook} that
@@ -289,7 +292,7 @@
addressbookType
)
checkProperties()
- self.commit()
+ yield self.commit()
# Make sure notification fired after commit
self.assertEquals(self.notifierFactory.history,
@@ -321,6 +324,7 @@
)
+ @inlineCallbacks
def test_removeAddressBookWithName_exists(self):
"""
L{IAddressBookHome.removeAddressBookWithName} removes a addressbook that already
@@ -333,7 +337,7 @@
home.removeAddressBookWithName(name)
self.assertEquals(home.addressbookWithName(name), None)
- self.commit()
+ yield self.commit()
# Make sure notification fired after commit
self.assertEquals(
@@ -444,6 +448,7 @@
)
+ @inlineCallbacks
def test_removeAddressBookObjectWithName_exists(self):
"""
Remove an existing addressbook object.
@@ -459,7 +464,7 @@
)
# Make sure notifications are fired after commit
- self.commit()
+ yield self.commit()
self.assertEquals(
self.notifierFactory.history,
[
@@ -577,6 +582,7 @@
self.assertEquals(before | set(['new-name']), after)
+ @inlineCallbacks
def test_createAddressBookObjectWithName_absent(self):
"""
L{IAddressBook.createAddressBookObjectWithName} creates a new
@@ -591,7 +597,7 @@
addressbookObject = addressbook1.addressbookObjectWithName(name)
self.assertEquals(addressbookObject.component(), component)
- self.commit()
+ yield self.commit()
# Make sure notifications fire after commit
self.assertEquals(
@@ -656,6 +662,7 @@
)
+ @inlineCallbacks
def test_addressbookHomeWithUID_create(self):
"""
L{IAddressBookStoreTransaction.addressbookHomeWithUID} with C{create=True}
@@ -674,11 +681,12 @@
self.assertProvides(IAddressBookHome, addressbookHome)
# A concurrent transaction shouldn't be able to read it yet:
self.assertIdentical(readOtherTxn(), None)
- self.commit()
+ yield self.commit()
# But once it's committed, other transactions should see it.
self.assertProvides(IAddressBookHome, readOtherTxn())
+ @inlineCallbacks
def test_setComponent(self):
"""
L{AddressBookObject.setComponent} changes the result of
@@ -697,7 +705,7 @@
addressbookObject = addressbook1.addressbookObjectWithName("1.vcf")
self.assertEquals(addressbookObject.component(), component)
- self.commit()
+ yield self.commit()
# Make sure notification fired after commit
self.assertEquals(
@@ -751,6 +759,7 @@
self.assertEquals(newEvent.properties().items(), [])
+ @inlineCallbacks
def test_setComponentPreservesProperties(self):
"""
L{IAddressBookObject.setComponent} preserves properties.
@@ -766,7 +775,7 @@
self.addressbookObjectUnderTest().properties()[
propertyName] = propertyContent
- self.commit()
+ yield self.commit()
# Sanity check; are properties even readable in a separate transaction?
# Should probably be a separate test.
self.assertEquals(
@@ -785,7 +794,7 @@
# Putting everything into a separate transaction to account for any
# caching that may take place.
- self.commit()
+ yield self.commit()
self.assertEquals(
self.addressbookObjectUnderTest().properties()[propertyName],
propertyContent
@@ -822,6 +831,7 @@
addressbook2.addressbookObjectWithUID(obj.uid()), None)
+ @inlineCallbacks
def test_eachAddressbookHome(self):
"""
L{IAddressbookTransaction.eachAddressbookHome} returns an iterator that
@@ -832,7 +842,7 @@
txn = self.transactionUnderTest()
for name in additionalUIDs:
txn.addressbookHomeWithUID(name, create=True)
- self.commit()
+ yield self.commit()
foundUIDs = set([])
lastTxn = None
for txn, home in self.storeUnderTest().eachAddressbookHome():
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100922/3c6639dc/attachment-0001.html>
More information about the calendarserver-changes
mailing list