[CalendarServer-changes] [9647] CalendarServer/branches/users/glyph/q
source_changes at macosforge.org
source_changes at macosforge.org
Sat Aug 11 01:55:20 PDT 2012
Revision: 9647
http://trac.macosforge.org/projects/calendarserver/changeset/9647
Author: glyph at apple.com
Date: 2012-08-11 01:55:20 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
test for pop()
Modified Paths:
--------------
CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_record.py
Property Changed:
----------------
CalendarServer/branches/users/glyph/q/
Modified: CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_record.py
===================================================================
--- CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_record.py 2012-08-11 08:55:19 UTC (rev 9646)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_record.py 2012-08-11 08:55:20 UTC (rev 9647)
@@ -24,7 +24,7 @@
from twisted.trial.unittest import TestCase
-from twext.enterprise.dal.record import fromTable, ReadOnly
+from twext.enterprise.dal.record import fromTable, ReadOnly, NoSuchRecord
from twext.enterprise.dal.syntax import SQLITE_DIALECT
from twext.enterprise.dal.test.test_parseschema import SchemaTestHelper
@@ -195,4 +195,23 @@
self.assertEqual([record.beta for record in records], [356, 345])
+ @inlineCallbacks
+ def test_pop(self):
+ """
+ A L{Record} may be loaded and deleted atomically, with L{Record.pop}.
+ """
+ txn = self.pool.connection()
+ for beta, gamma in [(123, u"one"), (234, u"two"), (345, u"three"),
+ (356, u"three"), (456, u"four")]:
+ yield txn.execSQL("insert into ALPHA values (:1, :2)",
+ [beta, gamma])
+ rec = yield TestRecord.pop(234)
+ self.assertEqual(rec.gamma, u'two')
+ self.assertEqual((yield txn.execSQL("select count(*) from ALPHA "
+ "where BETA = :1", [234])),
+ [[0]])
+ yield self.failUnlessFailure(TestRecord.pop(234), NoSuchRecord)
+
+
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/ec5448d3/attachment.html>
More information about the calendarserver-changes
mailing list