[Zope3-checkins] CVS: Zope3/src/zope/app/process/tests - startup.zcml:1.1 test_directives.py:1.1 test_registerrequestfactory.py:NONE test_registerservertype.py:NONE
Stephan Richter
srichter@cosmos.phy.tufts.edu
Sat, 2 Aug 2003 12:35:04 -0400
Update of /cvs-repository/Zope3/src/zope/app/process/tests
In directory cvs.zope.org:/tmp/cvs-serv29299/tests
Added Files:
startup.zcml test_directives.py
Removed Files:
test_registerrequestfactory.py test_registerservertype.py
Log Message:
Converted yet another namespace, this time 'startup'
=== Added File Zope3/src/zope/app/process/tests/startup.zcml ===
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:startup="http://namespaces.zope.org/startup">
<include package="zope.app.process" file="meta.zcml"/>
<startup:registerServerType
name="Browser"
factory="zope.server.http.publisherhttpserver.PublisherHTTPServer"
requestFactory="BrowserRequestFactory"
logFactory="zope.server.http.commonhitlogger.CommonHitLogger"
defaultPort="8080"
defaultVerbose="true" />'''
<startup:registerRequestFactory
name="BrowserRequestFactory"
publication="zope.app.publication.browser.BrowserPublication"
request="zope.publisher.browser.BrowserRequest"/>
<startup:registerRequestFactory
name="BrowserRequestFactory2"
factory="zope.app.process.tests.test_directives.tf"/>
</configure>
=== Added File Zope3/src/zope/app/process/tests/test_directives.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""startup ZCML namespace directive tests
$Id: test_directives.py,v 1.1 2003/08/02 16:34:58 srichter Exp $
"""
import unittest
from zope.app.interfaces.startup import IPublicationRequestFactoryFactory
from zope.app.process.requestfactoryregistry import getRequestFactory
from zope.app.process.servertyperegistry import getServerType
from zope.app.publication.browser import BrowserPublication
from zope.configuration import xmlconfig
from zope.interface import implements
from zope.publisher.browser import BrowserRequest
from zope.server.http.publisherhttpserver import PublisherHTTPServer
from zope.server.http.commonhitlogger import CommonHitLogger
from zope.testing.cleanup import CleanUp
import zope.app.process.tests
class TF:
"test request factory"
implements(IPublicationRequestFactoryFactory)
tf = TF()
class DirectivesTest(CleanUp, unittest.TestCase):
def setUp(self):
CleanUp.setUp(self)
self.context = xmlconfig.file("startup.zcml", zope.app.process.tests)
def test_registerServerType(self):
self.assertEqual(getServerType('Browser')._factory,
PublisherHTTPServer)
self.assertEqual(getServerType('Browser')._logFactory, CommonHitLogger)
self.assertEqual(getServerType('Browser')._requestFactory,
"BrowserRequestFactory")
self.assertEqual(getServerType('Browser')._defaultPort, 8080)
self.assertEqual(getServerType('Browser')._defaultVerbose, True)
def test_registerRequestFactory(self):
self.assertEqual(
getRequestFactory('BrowserRequestFactory')._pubFactory,
BrowserPublication)
self.assertEqual(
getRequestFactory('BrowserRequestFactory')._request,
BrowserRequest)
def test_registerRequestFactory_with_Factory(self):
self.assertEqual(getRequestFactory('BrowserRequestFactory2'), tf)
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(DirectivesTest),
))
if __name__ == '__main__':
unittest.main()
=== Removed File Zope3/src/zope/app/process/tests/test_registerrequestfactory.py ===
=== Removed File Zope3/src/zope/app/process/tests/test_registerservertype.py ===