[Zope3-checkins] CVS: Zope3/src/zope/app/tests - setup.py:1.6.2.2
Jim Fulton
jim at zope.com
Mon Sep 8 18:15:12 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/tests
In directory cvs.zope.org:/tmp/cvs-serv18062/src/zope/app/tests
Modified Files:
Tag: parentgeddon-branch
setup.py
Log Message:
Made a bunch of tests pass. :) Detailed messages will be provided
when merging to the head.
=== Zope3/src/zope/app/tests/setup.py 1.6.2.1 => 1.6.2.2 ===
--- Zope3/src/zope/app/tests/setup.py:1.6.2.1 Mon Sep 8 14:21:21 2003
+++ Zope3/src/zope/app/tests/setup.py Mon Sep 8 17:15:11 2003
@@ -105,6 +105,7 @@
from zope.app.content.folder import Folder, RootFolder
+from zope.app.container.add import add
def buildSampleFolderTree():
# set up a reasonably complex folder structure
#
@@ -117,15 +118,15 @@
# folder1_1_1 folder1_1_2 folder1_2_1 folder2_1_1
root = RootFolder()
- root.setObject('folder1', Folder())
- root['folder1'].setObject('folder1_1', Folder())
- root['folder1']['folder1_1'].setObject('folder1_1_1', Folder())
- root['folder1']['folder1_1'].setObject('folder1_1_2', Folder())
- root['folder1'].setObject('folder1_2', Folder())
- root['folder1']['folder1_2'].setObject('folder1_2_1', Folder())
- root.setObject('folder2', Folder())
- root['folder2'].setObject('folder2_1', Folder())
- root['folder2']['folder2_1'].setObject('folder2_1_1', Folder())
+ add(root, 'folder1', Folder())
+ add(root['folder1'], 'folder1_1', Folder())
+ add(root['folder1']['folder1_1'], 'folder1_1_1', Folder())
+ add(root['folder1']['folder1_1'], 'folder1_1_2', Folder())
+ add(root['folder1'], 'folder1_2', Folder())
+ add(root['folder1']['folder1_2'], 'folder1_2_1', Folder())
+ add(root, 'folder2', Folder())
+ add(root['folder2'], 'folder2_1', Folder())
+ add(root['folder2']['folder2_1'], 'folder2_1_1', Folder())
return root
@@ -140,16 +141,22 @@
from zope.app.services.service import ServiceRegistration
from zope.app.interfaces.services.registration import ActiveStatus
+
+from zope.app.interfaces.container import INameChooser
+def addRegistration(rm, reg):
+ name = zapi.getAdapter(rm, INameChooser).chooseName("", reg)
+ return add(rm, name, reg)
+
def addService(servicemanager, name, service, suffix=''):
"""Add a service to a service manager
This utility is useful for tests that need to set up services.
"""
default = zapi.traverse(servicemanager, 'default')
- default.setObject(name+suffix, service)
+ add(default, name+suffix, service)
path = "%s/default/%s" % (zapi.getPath(servicemanager), name+suffix)
registration = ServiceRegistration(name, path, default)
- key = default.getRegistrationManager().setObject("", registration)
+ key = addRegistration(default.getRegistrationManager(), registration)
zapi.traverse(default.getRegistrationManager(), key).status = ActiveStatus
return zapi.traverse(servicemanager, path)
More information about the Zope3-Checkins
mailing list