[Zope-CVS] CVS: Products/AdaptableStorage/gateway_sql/tests - testZope2SQL.py:1.6
Shane Hathaway
shane@zope.com
Fri, 10 Jan 2003 11:08:55 -0500
Update of /cvs-repository/Products/AdaptableStorage/gateway_sql/tests
In directory cvs.zope.org:/tmp/cvs-serv14707/gateway_sql/tests
Modified Files:
testZope2SQL.py
Log Message:
Moved toward SQL database independence. Tried to port to Gadfly, but
Gadfly doesn't even support simple sequences, so it's not interesting
enough. I'm checking in some of the changes anyway to simplify future
ports.
- Used a WHERE clause to limit the results of checking for table
existence rather than a LIMIT clause, since WHERE is more likely to be
supported everywhere.
- Changed the name of createMapper() to createPostgreSQLMapper().
Moved the creation of the connection to createPostgreSQLMapper(),
permitting reuse of createMapperPlus() by other databases.
=== Products/AdaptableStorage/gateway_sql/tests/testZope2SQL.py 1.5 => 1.6 ===
--- Products/AdaptableStorage/gateway_sql/tests/testZope2SQL.py:1.5 Tue Jan 7 00:07:38 2003
+++ Products/AdaptableStorage/gateway_sql/tests/testZope2SQL.py Fri Jan 10 11:08:22 2003
@@ -11,25 +11,30 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Test of storing folders in a Postgres database via ZODB
+"""Test of storing objects in relational databases via ZODB
$Id$
"""
import unittest
+from Products.AdaptableStorage.gateway_sql.public import PsycopgConnection
from Products.AdaptableStorage.zodb.ASDB import ASDB
from Products.AdaptableStorage.zodb.ASStorage import ASStorage
from Products.AdaptableStorage.zodb.StaticResource import StaticResource
-from Products.AdaptableStorage.Zope2SQL import createMapperPlus
+from Products.AdaptableStorage.Zope2SQL import createSQLMapper
from Products.AdaptableStorage.tests.Zope2TestBase import Zope2TestBase
class Zope2SQLTests (unittest.TestCase, Zope2TestBase):
+ def openConnection(self):
+ return PsycopgConnection('', 'test_temp')
+
def setUp(self):
- dm, conns, gws = createMapperPlus('', 'test_temp')
+ conn = self.openConnection()
+ dm, conns, gws = createSQLMapper(conn)
self.dm = dm
self.conns = conns
self.gws = gws