[Zope3-checkins] CVS: Zope3/src/zope/publisher/tests - httprequest.py:1.1.2.1 publication.py:1.1.2.1 views.py:1.1.2.1 xmlrpcviews.py:1.1.2.1 basetestipublisherrequest.py:1.1.2.3 test_baserequest.py:1.1.2.2 test_ipublication.py:1.1.2.3 test_httprequest.py:NONE test_publication.py:NONE test_views.py:NONE test_xmlrpcviews.py:NONE

Guido van Rossum guido@python.org
Mon, 23 Dec 2002 17:29:51 -0500


Update of /cvs-repository/Zope3/src/zope/publisher/tests
In directory cvs.zope.org:/tmp/cvs-serv20591

Modified Files:
      Tag: NameGeddon-branch
	basetestipublisherrequest.py test_baserequest.py 
	test_ipublication.py 
Added Files:
      Tag: NameGeddon-branch
	httprequest.py publication.py views.py xmlrpcviews.py 
Removed Files:
      Tag: NameGeddon-branch
	test_httprequest.py test_publication.py test_views.py 
	test_xmlrpcviews.py 
Log Message:
Move non-tests to non-test filenames.

=== Added File Zope3/src/zope/publisher/tests/httprequest.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.
# 
##############################################################################
"""
Test request for writing tests that need HTTP requests.

Note that this is used by tests in other packages.

$Id: httprequest.py,v 1.1.2.1 2002/12/23 22:29:50 gvanrossum Exp $
"""

from StringIO import StringIO

from zope.publisher.http import HTTPRequest

_testEnv =  {
    'SERVER_URL':         'http://foobar.com',
    'HTTP_HOST':          'foobar.com',
    'CONTENT_LENGTH':     '0',
    'GATEWAY_INTERFACE':  'Test/1.0',
}

class TestRequest(HTTPRequest):

    def __init__(self, body_instream=None, outstream=None, environ=None, **kw):
        if body_instream is None:
            body_instream = StringIO('')
        if outstream is None:
            outstream = StringIO()


        env = {}
        env.update(_testEnv)
        if environ: env.update(environ)
        env.update(kw)

        super(TestRequest, self).__init__(body_instream, outstream, env)


=== Added File Zope3/src/zope/publisher/tests/publication.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.
# 
##############################################################################

from zope.publisher.interfaces import IPublication

class TestPublication:

    __implements__ =  IPublication

    ############################################################
    # Implementation methods for interface
    # Zope.Publisher.IPublication.

    def afterCall(self, request):
        '''See interface IPublication'''
        self._afterCall = getattr(self, '_afterCall', 0) + 1

    def traverseName(self, request, ob, name, check_auth=1):
        '''See interface IPublication'''
        return getattr(ob, name, "%s value" % name)

    def afterTraversal(self, request, ob):
        '''See interface IPublication'''
        self._afterTraversal = getattr(self, '_afterTraversal', 0) + 1

    def beforeTraversal(self, request):
        '''See interface IPublication'''
        self._beforeTraversal = getattr(self, '_beforeTraversal', 0) + 1

    def callObject(self, request, ob):
        '''See interface IPublication'''
        return ob(request)

    def getApplication(self, request):
        '''See interface IPublication'''
        return app

    def handleException(self, object, request, exc_info, retry_allowed=1):
        '''See interface IPublication'''
        try:
            request.response.setBody("%s: %s" % (exc_info[:2]))
        finally:
            exc_info = 0

        
    def callTraversalHooks(self, request, ob):
        '''See interface IPublication'''
        self._callTraversalHooks = getattr(self, '_callTraversalHooks', 0) + 1

    #
    ############################################################

class App:

    def __init__(self, name):
        self.name = name

    def index_html(self, request):
        return self

app = App('')
app.ZopeCorp = App('ZopeCorp')
app.ZopeCorp.Engineering = App('Engineering')



=== Added File Zope3/src/zope/publisher/tests/views.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.
# 
##############################################################################
"""

Revision information: $Id: views.py,v 1.1.2.1 2002/12/23 22:29:50 gvanrossum Exp $
"""

from zope.interface import Interface
from zope.publisher.browser import BrowserView
from zope.publisher.interfaces.browser import IBrowserPresentation

class IC(Interface): pass

class V1(BrowserView): pass

class VZMI(V1): pass

class R1:
    __implements__ = IBrowserPresentation
    def __init__(self, request): self.request = request

class RZMI(R1):
    pass


=== Added File Zope3/src/zope/publisher/tests/xmlrpcviews.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.
# 
##############################################################################
"""

Revision information: $Id: xmlrpcviews.py,v 1.1.2.1 2002/12/23 22:29:50 gvanrossum Exp $
"""

from zope.interface import Interface
from zope.publisher.interfaces.xmlrpc import IXMLRPCPublisher

class IC(Interface): pass

class V1:
    __implements__ = IXMLRPCPublisher

    def __init__(self, context, request): 
        self.context = context
        self.request = request

class VZMI(V1):
    pass

class R1:
    def __init__(self, request): 
        self.request = request
    
    __implements__ = IXMLRPCPublisher

class RZMI(R1):
    pass


=== Zope3/src/zope/publisher/tests/basetestipublisherrequest.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/publisher/tests/basetestipublisherrequest.py:1.1.2.2	Mon Dec 23 16:04:48 2002
+++ Zope3/src/zope/publisher/tests/basetestipublisherrequest.py	Mon Dec 23 17:29:50 2002
@@ -33,7 +33,7 @@
         self.test_IPublisherRequest_processInputs
 
     def testPublicationManagement(self):
-        from zope.publisher.tests.test_publication import TestPublication
+        from zope.publisher.tests.publication import TestPublication
 
         request = self._Test__new()
         publication = TestPublication()


=== Zope3/src/zope/publisher/tests/test_baserequest.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/publisher/tests/test_baserequest.py:1.1.2.1	Mon Dec 23 14:33:11 2002
+++ Zope3/src/zope/publisher/tests/test_baserequest.py	Mon Dec 23 17:29:50 2002
@@ -59,7 +59,7 @@
         self.assertEqual(self._Test__new().supportsRetry(), 0)
 
     def test_IPublisherRequest_traverse(self):
-        from zope.publisher.tests.test_publication import TestPublication
+        from zope.publisher.tests.publication import TestPublication
         request = self._Test__new()
         request.setPublication(TestPublication())
         app = request.publication.getApplication(request)


=== Zope3/src/zope/publisher/tests/test_ipublication.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/publisher/tests/test_ipublication.py:1.1.2.2	Mon Dec 23 16:04:48 2002
+++ Zope3/src/zope/publisher/tests/test_ipublication.py	Mon Dec 23 17:29:50 2002
@@ -44,7 +44,7 @@
 class Test(BaseIPublicationTest, TestCase):
 
     def _Test__new(self):
-        from zope.publisher.tests.test_publication import TestPublication
+        from zope.publisher.tests.publication import TestPublication
         return TestPublication()
 
     def _Test__request(self):
@@ -84,7 +84,7 @@
         self.assertEqual(result, 42)
 
     def test_getApplication(self):
-        from zope.publisher.tests.test_publication import app
+        from zope.publisher.tests.publication import app
         result = self._publication.getApplication(self._request)
         self.assertEqual(id(result), id(app))
 

=== Removed File Zope3/src/zope/publisher/tests/test_httprequest.py ===

=== Removed File Zope3/src/zope/publisher/tests/test_publication.py ===

=== Removed File Zope3/src/zope/publisher/tests/test_views.py ===

=== Removed File Zope3/src/zope/publisher/tests/test_xmlrpcviews.py ===