[CalendarServer-changes] [11304] CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/ enterprise/dal/test/test_record.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jun 5 11:42:11 PDT 2013
Revision: 11304
http://trac.calendarserver.org//changeset/11304
Author: glyph at apple.com
Date: 2013-06-05 11:42:11 -0700 (Wed, 05 Jun 2013)
Log Message:
-----------
The problem is actually at a lower level, so, add a test at that level.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/enterprise/dal/test/test_record.py
Modified: CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/enterprise/dal/test/test_record.py
===================================================================
--- CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/enterprise/dal/test/test_record.py 2013-06-05 18:42:11 UTC (rev 11303)
+++ CalendarServer/branches/users/glyph/q-delete-no-concurrency/twext/enterprise/dal/test/test_record.py 2013-06-05 18:42:11 UTC (rev 11304)
@@ -30,6 +30,7 @@
from twext.enterprise.dal.test.test_parseschema import SchemaTestHelper
from twext.enterprise.dal.syntax import SchemaSyntax
from twisted.internet.defer import gatherResults
+from twisted.internet.defer import returnValue
from twext.enterprise.fixtures import buildConnectionPool
# from twext.enterprise.dal.syntax import
@@ -140,6 +141,30 @@
@inlineCallbacks
+ def oneRowCommitted(self, beta=123, gamma=u'456'):
+ """
+ Create, commit, and return one L{TestRecord}.
+ """
+ txn = self.pool.connection(self.id())
+ row = yield TestRecord.create(txn, beta=beta, gamma=gamma)
+ yield txn.commit()
+ returnValue(row)
+
+
+ @inlineCallbacks
+ def test_deleteWhenDeleted(self):
+ """
+ When a record object is deleted, if it's already been deleted, it will
+ raise L{NoSuchRecord}.
+ """
+ row = yield self.oneRowCommitted()
+ txn = self.pool.connection(self.id())
+ newRow = yield TestRecord.load(txn, row.beta)
+ yield newRow.delete()
+ self.failUnlessFailure(newRow.delete(), NoSuchRecord)
+
+
+ @inlineCallbacks
def test_cantCreateWithoutRequiredValues(self):
"""
When a L{Record} object is created without required values, it raises a
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130605/c4f936e1/attachment-0001.html>
More information about the calendarserver-changes
mailing list