[Zope3-checkins] CVS: Zope3/src/zope/app/utility - tests.py:1.5
Jim Fulton
jim at zope.com
Sun Apr 11 14:16:30 EDT 2004
Update of /cvs-repository/Zope3/src/zope/app/utility
In directory cvs.zope.org:/tmp/cvs-serv19161/src/zope/app/utility
Modified Files:
tests.py
Log Message:
Got rid of the module global utilityService. Now you must go through
getService to get the global utility service.
Renamed local var w long name
=== Zope3/src/zope/app/utility/tests.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/utility/tests.py:1.4 Sat Mar 13 17:02:11 2004
+++ Zope3/src/zope/app/utility/tests.py Sun Apr 11 14:16:29 2004
@@ -18,8 +18,7 @@
import unittest
from zope.app.tests import setup
from zope.app.site.tests import placefulsetup
-from zope.app import utility
-from zope.component.utility import utilityService as globalUtilityService
+from zope.app import utility, zapi
from zope.interface import Interface, implements
from zope.component import getService
from zope.component.exceptions import ComponentLookupError
@@ -89,12 +88,13 @@
utility.LocalUtilityService())
def test_queryUtility_delegates_to_global(self):
- globalUtilityService.provideUtility(IFoo, Foo("global"))
- globalUtilityService.provideUtility(IFoo, Foo("global bob"),
+ utilityService = zapi.getService(None, zapi.servicenames.Utilities)
+ utilityService.provideUtility(IFoo, Foo("global"))
+ utilityService.provideUtility(IFoo, Foo("global bob"),
name="bob")
utility_service = getService(self.rootFolder, "Utilities")
- self.assert_(utility_service != globalUtilityService)
+ self.assert_(utility_service != utilityService)
self.assertEqual(utility_service.queryUtility(IFoo).foo(),
"foo global")
@@ -110,12 +110,13 @@
self.assertEqual(utility_service.queryUtility(IFoo, name="rob"), None)
def test_getUtility_delegates_to_global(self):
- globalUtilityService.provideUtility(IFoo, Foo("global"))
- globalUtilityService.provideUtility(IFoo, Foo("global bob"),
+ utilityService = zapi.getService(None, zapi.servicenames.Utilities)
+ utilityService.provideUtility(IFoo, Foo("global"))
+ utilityService.provideUtility(IFoo, Foo("global bob"),
name="bob")
utility_service = getService(self.rootFolder, "Utilities")
- self.assert_(utility_service != globalUtilityService)
+ self.assert_(utility_service != utilityService)
self.assertEqual(utility_service.getUtility(IFoo).foo(),
"foo global")
@@ -152,8 +153,9 @@
def test_local_utilities(self):
- globalUtilityService.provideUtility(IFoo, Foo("global"))
- globalUtilityService.provideUtility(IFoo, Foo("global bob"),
+ utilityService = zapi.getService(None, zapi.servicenames.Utilities)
+ utilityService.provideUtility(IFoo, Foo("global"))
+ utilityService.provideUtility(IFoo, Foo("global bob"),
name="bob")
utilities = getService(self.rootFolder, "Utilities")
More information about the Zope3-Checkins
mailing list