[Zope3-checkins] CVS: Zope3/src/zope/app/content/tests - test_sqlscript.py:1.12
Stephan Richter
srichter@cosmos.phy.tufts.edu
Wed, 11 Jun 2003 09:48:29 -0400
Update of /cvs-repository/Zope3/src/zope/app/content/tests
In directory cvs.zope.org:/tmp/cvs-serv23479/content/tests
Modified Files:
test_sqlscript.py
Log Message:
Fixed SQLScript:
- Removed doubled 'Cache' menu entry.
- I had to context-wrap connectionName (using ContextProperty), since
ContextMethod(setConnectionName) did not work anymore.
- Caching also did not work correctly; in the __call__() method of SQLScript
it used a lit '[]' as the marker for the default return object; for some
reason this did not work. When I replaced the list with object(),
everything worked just fine.
- Removed many bare excepts and therefore XXX comments
- Cleaned up the ISQLScript interface to remove old cruft from the time I did
not feel comfortable with properties
- Fixed bug where it would not allow you to edit an SQL script unless a 'SQL
Connections Service' was registered.
- In the 'rdb' package, if we experience an exception during connect, we want
to convert this exception to a DatabaseException, so that the higher-level
machinery can catch it. Note that I had to leave the exception blank, since
DBI implementations have their own Exception hierarchy.
=== Zope3/src/zope/app/content/tests/test_sqlscript.py 1.11 => 1.12 ===
--- Zope3/src/zope/app/content/tests/test_sqlscript.py:1.11 Sat Jun 7 02:37:24 2003
+++ Zope3/src/zope/app/content/tests/test_sqlscript.py Wed Jun 11 09:47:58 2003
@@ -17,6 +17,9 @@
import unittest
+from zope.interface import implements
+from zope.interface.implements import implements as setImplements
+
from zope.app.interfaces.rdb import IConnectionService
from zope.app.interfaces.rdb import IZopeConnection
from zope.app.interfaces.rdb import IZopeCursor
@@ -39,7 +42,6 @@
from zope.app.cache.annotationcacheable import AnnotationCacheable
from zope.app.interfaces.traversing import IPhysicallyLocatable
from zope.app.interfaces.services.service import ISimpleService
-from zope.interface import implements
# Make spme fixes, so that we overcome some of the natural ZODB properties
@@ -129,6 +131,7 @@
def setUp(self):
PlacelessSetup.setUp(self)
+ setImplements(SQLScript, IAttributeAnnotatable)
sm.defineService('SQLDatabaseConnections', IConnectionService)
sm.provideService('SQLDatabaseConnections', ConnectionServiceStub())
self._old_getNextServiceManager = nextservice.getNextServiceManager
@@ -180,14 +183,11 @@
self.assertEqual(expected,
self._getScript().getSource())
- def testSetConnectionName(self):
+ def testConnectionName(self):
script = self._getScript()
- script.setConnectionName('test_conn')
- self.assertEqual('test_conn', script.getConnectionName())
-
- def testGetConnectionName(self):
- self.assertEqual('my_connection',
- self._getScript().getConnectionName())
+ self.assertEqual('my_connection', script.connectionName)
+ script.connectionName = 'test_conn'
+ self.assertEqual('test_conn', script.connectionName)
def testSQLScript(self):
result = self._getScript()(id=1)