[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/SQLScript/tests - testSQLScript.py:1.8
Albertas Agejevas
alga@codeworks.lt
Mon, 2 Dec 2002 15:04:20 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/SQLScript/tests
In directory cvs.zope.org:/tmp/cvs-serv5490/lib/python/Zope/App/OFS/Content/SQLScript/tests
Modified Files:
testSQLScript.py
Log Message:
Added stats reporting to the RAMCache.
Had to make Zope.App.RDB.ResultSet pickleable on the way.
Renamed ResultSet.names to ResultSet.columns.
Updated SQLScript to pass the location to the cache, not self.
=== Zope3/lib/python/Zope/App/OFS/Content/SQLScript/tests/testSQLScript.py 1.7 => 1.8 ===
--- Zope3/lib/python/Zope/App/OFS/Content/SQLScript/tests/testSQLScript.py:1.7 Mon Nov 25 08:48:07 2002
+++ Zope3/lib/python/Zope/App/OFS/Content/SQLScript/tests/testSQLScript.py Mon Dec 2 15:03:49 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""DT_SQLVar Tests
@@ -27,6 +27,7 @@
serviceManager as sm
from Zope.App.OFS.Content.SQLScript.SQLScript import SQLScript
+from Zope.App.OFS.Content.SQLScript.ISQLScript import ISQLScript
from Zope.App.OFS.Content.SQLScript.Arguments import Arguments
from Zope.App.OFS.Annotation.IAnnotatable import IAnnotatable
@@ -37,6 +38,7 @@
from Zope.App.Caching.ICacheable import ICacheable
from Zope.App.Caching.ICachingService import ICachingService
from Zope.App.Caching.AnnotationCacheable import AnnotationCacheable
+from Zope.App.Traversing.IPhysicallyLocatable import IPhysicallyLocatable
# Make spme fixes, so that we overcome some of the natural ZODB properties
def getNextServiceManager(context):
@@ -107,6 +109,19 @@
def getCache(self, name):
return self.caches[name]
+class LocatableStub:
+
+ __implements__ = IPhysicallyLocatable
+
+ def __init__(self, obj):
+ self.obj = obj
+
+ def getPhysicalRoot(self):
+ return None
+
+ def getPhysicalPath(self):
+ return (str(id(self.obj)),)
+
class SQLScriptTest(unittest.TestCase, PlacelessSetup):
@@ -123,6 +138,9 @@
IAttributeAnnotatable, IAnnotations,
AttributeAnnotations)
getService(None, "Adapters").provideAdapter(
+ ISQLScript, IPhysicallyLocatable,
+ LocatableStub)
+ getService(None, "Adapters").provideAdapter(
IAnnotatable, ICacheable,
AnnotationCacheable)
@@ -137,7 +155,7 @@
def testGetArguments(self):
assert isinstance(arguments, StringTypes), \
- '"arguments" argument of setArguments() must be a string'
+ '"arguments" argument of setArguments() must be a string'
self._arg_string = arguments
self.arguments = parseArguments(arguments)
@@ -177,7 +195,7 @@
def testSQLScript(self):
result = self._getScript()(id=1)
- self.assertEqual(result.names, ('name','counter'))
+ self.assertEqual(result.columns, ('name','counter'))
self.assertEqual(result[0].name, 'stephan')
def testSQLScriptCaching(self):