[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ComponentArchitecture/tests - testDirectives.py:1.4 testServiceDirective.py:1.4

Jim Fulton jim@zope.com
Thu, 20 Jun 2002 11:55:16 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/ComponentArchitecture/tests
In directory cvs.zope.org:/tmp/cvs-serv15462/lib/python/Zope/App/ComponentArchitecture/tests

Modified Files:
	testDirectives.py testServiceDirective.py 
Log Message:
implemented:

http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/MergeSecurityIntoZopeNamespace

While I was at it, I couldn't resist implementing a variation of:

http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/SecurityPackageReorg

which was a lot more work. 



=== Zope3/lib/python/Zope/App/ComponentArchitecture/tests/testDirectives.py 1.3 => 1.4 ===
 from cStringIO import StringIO
 
-from Zope.Configuration.xmlconfig import xmlconfig
+from Zope.Configuration.xmlconfig import xmlconfig, XMLConfig
 from Zope.Configuration.Exceptions import ConfigurationError
 
 from Zope.Security.Proxy import getTestProxyItems, getObject as proxiedObject
 
+import Zope.App.ComponentArchitecture
 from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
 from Zope.ComponentArchitecture \
      import getView, queryView, getResource, queryResource, createObject
@@ -32,14 +33,9 @@
      IV, IC, V1, VZMI, R1, RZMI
 from Zope.ComponentArchitecture.tests.Request import Request
 
-import Zope.App.ComponentArchitecture
-defs_path = os.path.join(
-    os.path.split(Zope.App.ComponentArchitecture.__file__)[0],
-    'meta.zcml')
 
 template = """<zopeConfigure
    xmlns='http://namespaces.zope.org/zope'
-   xmlns:security='http://namespaces.zope.org/security'>
    xmlns:test='http://www.zope.org/NS/Zope3/test'>
    %s
    </zopeConfigure>"""
@@ -53,7 +49,7 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        xmlconfig(open(defs_path))
+        XMLConfig('meta.zcml', Zope.App.ComponentArchitecture)()
 
     def testAdapter(self):
         from Zope.ComponentArchitecture import getAdapter, queryAdapter


=== Zope3/lib/python/Zope/App/ComponentArchitecture/tests/testServiceDirective.py 1.3 => 1.4 ===
 from cStringIO import StringIO
 
-from Zope.Configuration.xmlconfig import testxmlconfig as xmlconfig
+from Zope.Exceptions import Forbidden, Unauthorized
+
+from Zope.Configuration.xmlconfig import testxmlconfig as xmlconfig, XMLConfig
 from Zope.Configuration.Exceptions import ConfigurationError
 
-from Zope.Security.Proxy import getTestProxyItems, getObject as proxiedObject, ProxyFactory
+from Zope.Security.Proxy \
+     import getTestProxyItems, getObject as proxiedObject, ProxyFactory
 
 from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
 
-from Zope.Exceptions import Forbidden, Unauthorized
-
 from Zope.App.ComponentArchitecture.tests.TestService \
      import IFooService, FooService
 
+import Zope.App.ComponentArchitecture
 from Zope.ComponentArchitecture import getService
-
 from Zope.ComponentArchitecture.tests.PlacelessSetup import PlacelessSetup
 
-import Zope.App.ComponentArchitecture
-defs_path = os.path.join(
-    os.path.split(Zope.App.ComponentArchitecture.__file__)[0],
-    'meta.zcml')
 
 template = """<zopeConfigure
    xmlns='http://namespaces.zope.org/zope'
-   xmlns:security='http://namespaces.zope.org/security'>
    xmlns:test='http://www.zope.org/NS/Zope3/test'>
    %s
    </zopeConfigure>"""
@@ -52,7 +48,7 @@
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        xmlconfig(open(defs_path))
+        XMLConfig('meta.zcml', Zope.App.ComponentArchitecture)()
 
     def testServiceConfigNoType(self):
         from Zope.ComponentArchitecture.GlobalServiceManager \
@@ -168,13 +164,14 @@
         
         xmlconfig(StringIO(template % (
             """
-            <directives namespace="http://namespaces.zope.org/security">
+            <directives namespace="http://namespaces.zope.org/zope">
               <directive name="permission"
                  attributes="id title description"
-                 handler="Zope.App.Security.metaConfigure.definePermission" />
+                 handler="
+              Zope.App.Security.Registries.metaConfigure.definePermission" />
             </directives>
 
-            <security:permission id="XXX" title="xxx" />
+            <permission id="XXX" title="xxx" />
 
             <serviceType id="Foo"
                          interface="