[Zope3-checkins] CVS: Zope3/lib/python/Zope/Publisher/XMLRPC/tests - testDirectives.py:1.3
R. David Murray
bitz@bitdance.com
Fri, 8 Nov 2002 13:54:33 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/XMLRPC/tests
In directory cvs.zope.org:/tmp/cvs-serv1620/lib/python/Zope/Publisher/XMLRPC/tests
Modified Files:
testDirectives.py
Log Message:
Refactor to eliminate use of top level directive directive and
simplify by using utility function from Zope.Configuration.tests.
Along the way, reformat test zcml to match style guide.
=== Zope3/lib/python/Zope/Publisher/XMLRPC/tests/testDirectives.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/Publisher/XMLRPC/tests/testDirectives.py:1.2 Mon Jun 10 19:29:33 2002
+++ Zope3/lib/python/Zope/Publisher/XMLRPC/tests/testDirectives.py Fri Nov 8 13:54:32 2002
@@ -12,20 +12,16 @@
#
##############################################################################
import unittest
+from cStringIO import StringIO
from Zope.Configuration.xmlconfig import xmlconfig
from Zope.Publisher.XMLRPC.IXMLRPCPublisher import IXMLRPCPublisher
from Zope.Publisher.XMLRPC.tests.TestViews import IC, V1, VZMI, R1, RZMI
from Zope.ComponentArchitecture.tests.PlacelessSetup import PlacelessSetup
from Zope.ComponentArchitecture import queryView
-from cStringIO import StringIO
+from Zope.Configuration.tests.BaseTestDirectivesXML import makeconfig
from Zope.ComponentArchitecture.tests.Request import Request
-template = """<zopeConfigure
- xmlns='http://namespaces.zope.org/zope'
- xmlns:xmlrpc='http://namespaces.zope.org/xmlrpc'>
- %s
- </zopeConfigure>"""
class Ob:
__implements__ = IC
@@ -38,17 +34,16 @@
self.assertEqual(queryView(ob, 'test', Request(IXMLRPCPublisher)),
None)
- xmlconfig(StringIO(template % (
- '''
- <directive name="view"
- attributes="component name for layer"
- handler="Zope.Publisher.XMLRPC.metaConfigure.view"
- namespace="http://namespaces.zope.org/xmlrpc" />
- <xmlrpc:view name="test"
- factory="Zope.Publisher.XMLRPC.tests.TestViews.V1"
- for="Zope.Publisher.XMLRPC.tests.TestViews.IC" />
- '''
- )))
+ xmlconfig(makeconfig(
+ '''<directive
+ name="view"
+ attributes="component name for layer"
+ handler="Zope.Publisher.XMLRPC.metaConfigure.view" />''',
+ '''<test:view
+ name="test"
+ factory="Zope.Publisher.XMLRPC.tests.TestViews.V1"
+ for="Zope.Publisher.XMLRPC.tests.TestViews.IC" />'''
+ ))
self.assertEqual(queryView(ob, 'test', Request(IXMLRPCPublisher), None
).__class__, V1)