[CalendarServer-changes] [9628] CalendarServer/branches/users/glyph/q

source_changes at macosforge.org source_changes at macosforge.org
Sat Aug 11 01:55:04 PDT 2012


Revision: 9628
          http://trac.macosforge.org/projects/calendarserver/changeset/9628
Author:   glyph at apple.com
Date:     2012-08-11 01:55:04 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
Test for deletion.

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:03 UTC (rev 9627)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_record.py	2012-08-11 08:55:04 UTC (rev 9628)
@@ -30,6 +30,7 @@
 from twext.enterprise.dal.test.test_parseschema import SchemaTestHelper
 from twext.enterprise.adbapi2 import ConnectionPool
 from twext.enterprise.dal.syntax import SchemaSyntax
+from twisted.internet.defer import gatherResults
 
 # from twext.enterprise.dal.syntax import
 
@@ -103,6 +104,24 @@
 
 
     @inlineCallbacks
+    def test_simpleDelete(self):
+        """
+        When a record object is deleted, a row with a matching primary key will
+        be created in the database.
+        """
+        txn = self.pool.connection()
+        def mkrow(beta, gamma):
+            return txn.execSQL("insert into ALPHA values (:1, :2)",
+                               [beta, gamma])
+        yield gatherResults([mkrow(123, "one"), mkrow(234, "two"),
+                             mkrow(345, "three")])
+        tr = yield TestRecord.load(txn, 234)
+        yield tr.delete()
+        rows = yield txn.execSQL("select BETA, GAMMA from ALPHA order by BETA")
+        self.assertEqual(rows, [[123, "one"], [345, "three"]])
+
+
+    @inlineCallbacks
     def test_attributesArentMutableYet(self):
         """
         Changing attributes on a database object is not supported yet, because
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/221c9baa/attachment.html>


More information about the calendarserver-changes mailing list