[Zope-Checkins] CVS: Zope3/lib/python/Zope/StartUp/tests - testRegisterRequestFactory.py:1.1.2.2.14.1
Jim Fulton
jim@zope.com
Wed, 29 May 2002 11:09:56 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/StartUp/tests
In directory cvs.zope.org:/tmp/cvs-serv12181/lib/python/Zope/StartUp/tests
Modified Files:
Tag: Zope3InWonderland-branch
testRegisterRequestFactory.py
Log Message:
- Added permission_id attribute to adapter and utility directives.
- Got rid of old getView, getResource, and getDefaultViewName.
Renamed getRequestView to getView (and so on).
Changed view interface to use context, rather than getContext.
Introduced notion of presentation types (e.g. IBrowserPresentation,
which is cleaner than IBrowserPublisher).
- Began converting to get/queryFoo, which is much nicer.
- Many formatting fixups.
=== Zope3/lib/python/Zope/StartUp/tests/testRegisterRequestFactory.py 1.1.2.2 => 1.1.2.2.14.1 ===
#
##############################################################################
-"""
-
-$Id$
-"""
-
-import unittest
-from Zope.StartUp.RequestFactoryRegistry import getRequestFactory
-
-from Zope.Configuration.xmlconfig import xmlconfig
-from cStringIO import StringIO
-
-
-template = """<zopeConfigure
- xmlns='http://namespaces.zope.org/zope'
- xmlns:startup='http://namespaces.zope.org/startup'>
- %s
- </zopeConfigure>"""
-
-
-class Test( unittest.TestCase ):
-
-
- def testRegisterRequestFactory(self):
-
- xmlconfig(StringIO(template % (
- '''
- <directive name="registerRequestFactory"
- attributes="name, publication, request"
- handler="Zope.StartUp.metaConfigure.registerRequestFactory"
- namespace="http://namespaces.zope.org/startup" />
-
- <startup:registerRequestFactory name="BrowserRequestFactory"
- publication =
- "Zope.App.ZopePublication.Browser.Publication.BrowserPublication"
- request = "Zope.Publisher.Browser.BrowserRequest." />
- '''
- )))
-
- from Zope.App.ZopePublication.Browser.Publication import \
- BrowserPublication
- from Zope.Publisher.Browser.BrowserRequest import BrowserRequest
-
- self.assertEqual(
- getRequestFactory('BrowserRequestFactory')._pubFactory,
- BrowserPublication)
- self.assertEqual(
- getRequestFactory('BrowserRequestFactory')._request,
- BrowserRequest)
-
-
-
-def test_suite():
- loader = unittest.TestLoader()
- return loader.loadTestsFromTestCase( Test )
-
-
-if __name__=='__main__':
- unittest.TextTestRunner().run( test_suite() )
-
+"""
+
+$Id$
+"""
+
+import unittest
+from Zope.StartUp.RequestFactoryRegistry import getRequestFactory
+
+from Zope.Configuration.xmlconfig import xmlconfig
+from cStringIO import StringIO
+
+
+template = """<zopeConfigure
+ xmlns='http://namespaces.zope.org/zope'
+ xmlns:startup='http://namespaces.zope.org/startup'>
+ %s
+ </zopeConfigure>"""
+
+
+class Test( unittest.TestCase ):
+
+
+ def testRegisterRequestFactory(self):
+
+ xmlconfig(StringIO(template % (
+ '''
+ <directive name="registerRequestFactory"
+ attributes="name, publication, request"
+ handler="Zope.StartUp.metaConfigure.registerRequestFactory"
+ namespace="http://namespaces.zope.org/startup" />
+
+ <startup:registerRequestFactory name="BrowserRequestFactory"
+ publication =
+ "Zope.App.ZopePublication.Browser.Publication.BrowserPublication"
+ request = "Zope.Publisher.Browser.BrowserRequest." />
+ '''
+ )))
+
+ from Zope.App.ZopePublication.Browser.Publication import \
+ BrowserPublication
+ from Zope.Publisher.Browser.BrowserRequest import BrowserRequest
+
+ self.assertEqual(
+ getRequestFactory('BrowserRequestFactory')._pubFactory,
+ BrowserPublication)
+ self.assertEqual(
+ getRequestFactory('BrowserRequestFactory')._request,
+ BrowserRequest)
+
+
+
+def test_suite():
+ loader = unittest.TestLoader()
+ return loader.loadTestsFromTestCase( Test )
+
+
+if __name__=='__main__':
+ unittest.TextTestRunner().run( test_suite() )
+