[z3-checkins] r33695 - z3/sqlos/trunk/src/sqlos/ftests

jinty at codespeak.net jinty at codespeak.net
Tue Oct 24 21:44:14 CEST 2006


Author: jinty
Date: Tue Oct 24 21:44:10 2006
New Revision: 33695

Modified:
   z3/sqlos/trunk/src/sqlos/ftests/localutilities.txt
Log:
update to new component API

Modified: z3/sqlos/trunk/src/sqlos/ftests/localutilities.txt
==============================================================================
--- z3/sqlos/trunk/src/sqlos/ftests/localutilities.txt	(original)
+++ z3/sqlos/trunk/src/sqlos/ftests/localutilities.txt	Tue Oct 24 21:44:10 2006
@@ -7,7 +7,8 @@
 
 First we need to set up some folder structure to set up a site.
 
-    >>> from zope.app import zapi
+    >>> import zope.component
+    >>> import zope.traversing.api
     >>> from zope.app.folder import Folder
     >>> from zope.app.component import interfaces as componentInterfaces
     >>> from zope.app.component.site import LocalSiteManager
@@ -26,26 +27,19 @@
 Let's get the connection name:
 
     >>> from sqlos.interfaces import IConnectionName
-    >>> connection_name = zapi.getUtility(IConnectionName).name
+    >>> connection_name = zope.component.getUtility(IConnectionName).name
 
 Now we set up a local database utility
 
     >>> from zope.rdb.interfaces import IZopeDatabaseAdapter
-    >>> from zope.app.component.interfaces.registration import ActiveStatus
     >>> from sqlos.testing.testdb import SQLiteda
-    >>> from zope.app.utility import UtilityRegistration
 
     >>> dbAdapter = SQLiteda(u'dbi://:memory:')
-    >>> reg = UtilityRegistration(connection_name,
-    ...                           IZopeDatabaseAdapter,
-    ...                           dbAdapter)
-    >>> default = sm['default']
-    >>> key = default.registrationManager.addRegistration(reg)
-    >>> zapi.traverse(default.registrationManager, key).status = ActiveStatus
+    >>> sm.registerUtility(dbAdapter, provided=IZopeDatabaseAdapter, name=connection_name)
 
     >>> localUtility = sm.queryUtility(IZopeDatabaseAdapter, connection_name)
-    >>> localUtility
-    <sqlos.testing.testdb.SQLiteda object at ...>
+    >>> localUtility is dbAdapter
+    True
 
     >>> localUtility is dbAdapter
     True
@@ -54,7 +48,7 @@
 make sure that our localUtility is not identical to the global sqlite utility
 that has been registered through ftesting.zcml.
 
-    >>> gsm = zapi.getGlobalSiteManager()
+    >>> gsm = zope.component.getGlobalSiteManager()
     >>> globalUtility = gsm.queryUtility(IZopeDatabaseAdapter, connection_name)
     >>> globalUtility is not localUtility
     True


More information about the z3-checkins mailing list