[Zope3-checkins] CVS: Zope3/src/zope/app/services/tests - test_configurations.py:1.9

Guido van Rossum guido@python.org
Thu, 12 Jun 2003 13:04:16 -0400


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

Modified Files:
	test_configurations.py 
Log Message:
Use/allow relative paths in ComponentConfiguration subclasses.
Existing absolute paths will continue to work, but all newly created
ComponentConfiguration subclass instances will use a path relative to
the site management folder containing the configured object -- i.e.,
this is just the object's name.  Fixed all places where I've seen
absolute paths used.  (Still to do: use relative paths for references
*to* the configuration object as well; these occur in registries, and
are also used by the IUseConfigurable machinery and by dependencies.)


=== Zope3/src/zope/app/services/tests/test_configurations.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/services/tests/test_configurations.py:1.8	Sat Jun  7 01:32:01 2003
+++ Zope3/src/zope/app/services/tests/test_configurations.py	Thu Jun 12 13:03:45 2003
@@ -82,20 +82,20 @@
 
     def test_getComponent(self):
         # set up a component
-        path, component = 'foo', object()
-        self.rootFolder.setObject(path, component)
+        name, component = 'foo', object()
+        self.rootFolder.setObject(name, component)
         # set up a configuration
-        cfg = ComponentConfiguration(path)
+        cfg = ComponentConfiguration("/"+name)
         cfg = ContextWrapper(cfg, self.rootFolder)
         # check that getComponent finds the configuration
         self.assertEquals(cfg.getComponent(), component)
 
     def test_getComponent_permission(self):
         # set up a component
-        path, component = 'foo', object()
-        self.rootFolder.setObject(path, component)
+        name, component = 'foo', object()
+        self.rootFolder.setObject(name, component)
         # set up a configuration
-        cfg = ComponentConfiguration(path, 'zope.TopSecret')
+        cfg = ComponentConfiguration("/"+name, 'zope.TopSecret')
         cfg.getInterface = lambda: ITestComponent
         cfg = ContextWrapper(cfg, self.rootFolder)
         # check that getComponent finds the configuration
@@ -105,10 +105,10 @@
 
     def test_afterAddHook(self):
         # set up a component
-        path, component = 'foo', ComponentStub()
-        self.rootFolder.setObject(path, component)
+        name, component = 'foo', ComponentStub()
+        self.rootFolder.setObject(name, component)
         # set up a configuration
-        cfg = ComponentConfiguration(path)
+        cfg = ComponentConfiguration("/"+name)
         self.rootFolder.setObject('cfg', cfg)
         cfg = traverse(self.rootFolder, 'cfg')
         # simulate IAddNotifiable
@@ -118,11 +118,11 @@
 
     def test_beforeDeleteHook_dependents(self):
         # set up a component
-        path, component = 'foo', ComponentStub()
-        self.rootFolder.setObject(path, component)
+        name, component = 'foo', ComponentStub()
+        self.rootFolder.setObject(name, component)
         component.addDependent('/cfg')
         # set up a configuration
-        cfg = ComponentConfiguration(path)
+        cfg = ComponentConfiguration("/"+name)
         cfg.status = Unregistered
         self.rootFolder.setObject('cfg', cfg)
         cfg = traverse(self.rootFolder, 'cfg')