[Zope3-checkins] CVS: Zope3/src/zope/app/rdb/tests - rdb.zcml:1.2 test_directives.py:1.3

Mohan Chandra mchandra at zeomega.com
Fri Dec 19 11:53:48 EST 2003


Update of /cvs-repository/Zope3/src/zope/app/rdb/tests
In directory cvs.zope.org:/tmp/cvs-serv28838/src/zope/app/rdb/tests

Modified Files:
	rdb.zcml test_directives.py 
Log Message:
Removal of Databaseconnection service 



=== Zope3/src/zope/app/rdb/tests/rdb.zcml 1.1 => 1.2 ===
--- Zope3/src/zope/app/rdb/tests/rdb.zcml:1.1	Sun Aug  3 12:07:44 2003
+++ Zope3/src/zope/app/rdb/tests/rdb.zcml	Fri Dec 19 11:53:18 2003
@@ -3,7 +3,7 @@
 
   <include package="zope.app.component" file="meta.zcml"/>
   <include package="zope.app.rdb" file="meta.zcml"/>
-  <include package="zope.app.rdb" file="service.zcml"/>
+
 
   <rdb:provideConnection 
       name="stub"


=== Zope3/src/zope/app/rdb/tests/test_directives.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/rdb/tests/test_directives.py:1.2	Sun Aug 17 02:07:52 2003
+++ Zope3/src/zope/app/rdb/tests/test_directives.py	Fri Dec 19 11:53:18 2003
@@ -16,21 +16,32 @@
 $Id$
 """
 import unittest
-
+from zope.app import zapi
+from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.component import getUtilitiesFor, queryUtility
 from zope.configuration import xmlconfig
-from zope.app.rdb import queryConnection, getAvailableConnections
+from zope.app.interfaces.rdb import IZopeDatabaseAdapter
+from zope.app.rdb.tests.test_zopedatabaseadapter import DAStub
 from zope.app.rdb import ZopeConnection
 import zope.app.rdb.tests
 
-class DirectivesTest(unittest.TestCase):
+class DirectivesTest(PlacelessSetup, unittest.TestCase):
 
     def test_provideConnection(self):
-        self.assertEqual(getAvailableConnections(), [])
-        self.assertEqual(queryConnection('stub', None), None)
+
+        conns = zapi.getUtilitiesFor(None, IZopeDatabaseAdapter)
+        self.assertEqual(conns, [])
+        connectionstub = queryUtility(None,IZopeDatabaseAdapter, None, 'stub')
+        self.assertEqual(connectionstub, None)
+
         self.context = xmlconfig.file("rdb.zcml", zope.app.rdb.tests)
-        self.assertEqual(getAvailableConnections(), ["stub"])
-        self.assertEqual(queryConnection('stub').__class__, ZopeConnection)
-        self.assertEqual(queryConnection('stubbie', None), None)
+        connectionstub = queryUtility(None,IZopeDatabaseAdapter, None, 'stub')
+        connection = connectionstub()
+        self.assertEqual(connectionstub.__class__, DAStub)
+        conns = zapi.getUtilitiesFor(None, IZopeDatabaseAdapter)
+           
+        self.assertEqual([c[0] for c in conns], ["stub"])
+        self.assertEqual(connection.__class__, ZopeConnection)
 
 
 def test_suite():




More information about the Zope3-Checkins mailing list