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

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


Revision: 9678
          http://trac.macosforge.org/projects/calendarserver/changeset/9678
Author:   glyph at apple.com
Date:     2012-08-11 01:55:47 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
test for new method to load all instances of a given type in the DB

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:46 UTC (rev 9677)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_record.py	2012-08-11 08:55:47 UTC (rev 9678)
@@ -178,6 +178,24 @@
 
 
     @inlineCallbacks
+    def test_all(self):
+        """
+        L{Record.all} will return all instances of the record, sorted by
+        primary key.
+        """
+        txn = self.pool.connection()
+        data = [(123, u"one"), (456, u"four"), (345, u"three"),
+                (234, u"two"), (356, u"three")]
+        for beta, gamma in data:
+            yield txn.execSQL("insert into ALPHA values (:1, :2)",
+                              [beta, gamma])
+        self.assertEqual(
+            [(x.beta, x.gamma) for x in (yield TestRecord.all(txn))],
+            sorted(data)
+        )
+
+
+    @inlineCallbacks
     def test_orderedQuery(self):
         """
         L{Record.query} takes an 'order' argument which will allow the objects
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/f99766a1/attachment-0001.html>


More information about the calendarserver-changes mailing list