[Zope3-checkins] CVS: Zope3/src/zope/app/utilities/tests -
test_interfaceutility.py:1.5
Jim Fulton
jim at zope.com
Sun Sep 21 13:33:50 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/utilities/tests
In directory cvs.zope.org:/tmp/cvs-serv15584/src/zope/app/utilities/tests
Modified Files:
test_interfaceutility.py
Log Message:
Changed to use __setitem__ rather than setObject
No-longer use context wrappers.
=== Zope3/src/zope/app/utilities/tests/test_interfaceutility.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/utilities/tests/test_interfaceutility.py:1.4 Fri Aug 15 20:44:27 2003
+++ Zope3/src/zope/app/utilities/tests/test_interfaceutility.py Sun Sep 21 13:33:49 2003
@@ -38,7 +38,6 @@
from zope.app.interfaces.services.utility import ILocalUtility
from zope.app.interfaces.services.registration import IRegistered
from zope.app.interfaces.dependable import IDependable
-from zope.context import getWrapperContainer
from zope.app.tests import setup
from zope.interface.interface import InterfaceClass
from zope.interface.interfaces import IInterface
@@ -226,7 +225,7 @@
def test_registrationsFor_methods(self):
utilities = getService(self.rootFolder, Utilities)
default = traverse(self.rootFolder, "++etc++site/default")
- default.setObject('foo', Foo("local"))
+ default['foo'] = Foo("local")
path = "/++etc++site/default/foo"
for name in ('', 'bob'):
@@ -246,18 +245,19 @@
utilities = getService(self.rootFolder, Utilities)
default = traverse(self.rootFolder, "++etc++site/default")
- default.setObject('foo', Foo("local"))
+ default['foo'] = Foo("local")
path = "/++etc++site/default/foo"
cm = default.getRegistrationManager()
for name in ('', 'bob'):
registration = utility.UtilityRegistration(name, IInterface, path)
- cname = cm.setObject('', registration)
+ cname = cm.addRegistration(registration)
registration = traverse(cm, cname)
gout = name and "foo global "+name or "foo global"
- self.assertEqual(utilities.getUtility(IInterface, name=name).foo(), gout)
+ self.assertEqual(utilities.getUtility(IInterface, name=name).foo(),
+ gout)
registration.status = ActiveStatus
@@ -266,7 +266,8 @@
registration.status = RegisteredStatus
- self.assertEqual(utilities.getUtility(IInterface, name=name).foo(), gout)
+ self.assertEqual(utilities.getUtility(IInterface, name=name).foo(),
+ gout)
def test_getRegisteredMatching(self):
self.test_local_utilities()
@@ -279,8 +280,8 @@
cr2 = utilities.queryRegistrationsFor(
utility.UtilityRegistration("bob", IInterface, path))
self.assertEqual(r, [(IInterface, "", cr1), (IInterface, "bob", cr2)])
- self.assertEqual(getWrapperContainer(r[0][2]), utilities)
- self.assertEqual(getWrapperContainer(r[1][2]), utilities)
+ self.assertEqual(r[0][2].__parent__, utilities)
+ self.assertEqual(r[1][2].__parent__, utilities)
# Now test that an empty registry doesn't show up
for cd in cr1.info(): # Remove everything from cr1
cd['registration'].status = UnregisteredStatus
More information about the Zope3-Checkins
mailing list