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

source_changes at macosforge.org source_changes at macosforge.org
Sat Aug 11 01:54:39 PDT 2012


Revision: 9597
          http://trac.macosforge.org/projects/calendarserver/changeset/9597
Author:   glyph at apple.com
Date:     2012-08-11 01:54:39 -0700 (Sat, 11 Aug 2012)
Log Message:
-----------
Add testing facilities to make the test failure real.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_sqlsyntax.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/q/

Modified: CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_sqlsyntax.py
===================================================================
--- CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_sqlsyntax.py	2012-08-11 08:54:38 UTC (rev 9596)
+++ CalendarServer/branches/users/glyph/q/twext/enterprise/dal/test/test_sqlsyntax.py	2012-08-11 08:54:39 UTC (rev 9597)
@@ -66,14 +66,31 @@
 
     def __init__(self, dialect=SQLITE_DIALECT, paramstyle='numeric'):
         self.execed = []
+        self.pendingResults = []
         self.dialect = SQLITE_DIALECT
         self.paramstyle = 'numeric'
 
 
+    def nextResult(self, result):
+        """
+        Make it so that the next result from L{execSQL} will be the argument.
+        """
+        self.pendingResults.append(result)
+
+
     def execSQL(self, sql, args, rozrc):
+        """
+        Implement L{IAsyncTransaction} by recording C{sql} and C{args} in
+        C{self.execed}, and return a L{Deferred} firing either an integer or a
+        value pre-supplied by L{CatchSQL.nextResult}.
+        """
         self.execed.append([sql, args])
         self.counter += 1
-        return succeed(self.counter)
+        if self.pendingResults:
+            result = self.pendingResults.pop(0)
+        else:
+            result = self.counter
+        return succeed(result)
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120811/c721c041/attachment.html>


More information about the calendarserver-changes mailing list