[Zope3-checkins] CVS: Zope3/src/zope/publisher/tests -
basetestipublicationrequest.py:1.4 test_browserrequest.py:1.9
test_http.py:1.21 test_xmlrpcrequest.py:1.6
Jim Fulton
cvs-admin at zope.org
Fri Nov 21 12:12:30 EST 2003
Update of /cvs-repository/Zope3/src/zope/publisher/tests
In directory cvs.zope.org:/tmp/cvs-serv32719/src/zope/publisher/tests
Modified Files:
basetestipublicationrequest.py test_browserrequest.py
test_http.py test_xmlrpcrequest.py
Log Message:
Requests no longer need to track presentation types, since resources
and views are now registered as adapters of requests.
=== Zope3/src/zope/publisher/tests/basetestipublicationrequest.py 1.3 => 1.4 ===
--- Zope3/src/zope/publisher/tests/basetestipublicationrequest.py:1.3 Fri Aug 8 14:07:21 2003
+++ Zope3/src/zope/publisher/tests/basetestipublicationrequest.py Fri Nov 21 12:12:29 2003
@@ -60,7 +60,3 @@
request.setPresentationSkin(skin)
self.assertEqual(request.getPresentationSkin(), skin)
- def test_getPresentationType(self):
- type = self._Test__expectedViewType()
- request = self._Test__new()
- self.assertEqual(request.getPresentationType(), type)
=== Zope3/src/zope/publisher/tests/test_browserrequest.py 1.8 => 1.9 ===
--- Zope3/src/zope/publisher/tests/test_browserrequest.py:1.8 Fri Aug 8 14:07:21 2003
+++ Zope3/src/zope/publisher/tests/test_browserrequest.py Fri Nov 21 12:12:29 2003
@@ -14,7 +14,7 @@
import unittest
from zope.component.tests.placelesssetup import PlacelessSetup
-from zope.component.adapter import provideAdapter
+from zope.app.tests import ztapi
from zope.i18n.interfaces import IUserPreferredCharsets
@@ -24,8 +24,8 @@
from zope.publisher.interfaces import NotFound
from zope.publisher.base import DefaultPublication
-from zope.publisher.interfaces.browser \
- import IBrowserPresentation, IBrowserRequest, IBrowserApplicationRequest
+from zope.publisher.interfaces.browser import IBrowserApplicationRequest
+from zope.publisher.interfaces.browser import IBrowserRequest
from zope.interface.verify import verifyObject
from StringIO import StringIO
@@ -61,7 +61,8 @@
def setUp(self):
PlacelessSetup.setUp(self)
- provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)
+ ztapi.provideAdapter(IHTTPRequest, IUserPreferredCharsets,
+ HTTPCharsets)
class AppRoot:
" "
@@ -131,7 +132,6 @@
# test the IView request
r = self._createRequest()
- self.failUnless(r.getPresentationType() is IBrowserPresentation)
self.assertEqual(r.getPresentationSkin(), '')
r.setPresentationSkin('morefoo')
self.assertEqual(r.getPresentationSkin(), 'morefoo')
=== Zope3/src/zope/publisher/tests/test_http.py 1.20 => 1.21 ===
--- Zope3/src/zope/publisher/tests/test_http.py:1.20 Sun Aug 17 02:09:17 2003
+++ Zope3/src/zope/publisher/tests/test_http.py Fri Nov 21 12:12:29 2003
@@ -13,15 +13,19 @@
##############################################################################
import unittest
+# XXX evil zope.app imports :(
from zope.app.services.tests.placefulsetup import PlacefulSetup
from zope.app.interfaces.security import IPrincipal
+
+# XX, Hm, zope.component dependency is suspect
+import zope.component
+
from zope.interface import implements
-from zope.component.adapter import provideAdapter
from zope.publisher.interfaces.logginginfo import ILoggingInfo
from zope.publisher.http import HTTPRequest
from zope.publisher.publish import publish
from zope.publisher.base import DefaultPublication
-from zope.publisher.interfaces.http import IHTTPPresentation, IHTTPRequest
+from zope.publisher.interfaces.http import IHTTPRequest
from zope.i18n.interfaces import ILocale
@@ -226,7 +230,9 @@
auth_user_name = None
def setAuthUserName(self, name):
self.auth_user_name = name
- provideAdapter(IPrincipal, ILoggingInfo, PrincipalLoggingStub)
+
+ as = zope.component.getService(None, 'Adapters')
+ as.provideAdapter(IPrincipal, ILoggingInfo, [PrincipalLoggingStub])
task = HTTPTaskStub()
req = self._createRequest(outstream=task)
req.setUser(UserStub("jim"))
@@ -240,7 +246,6 @@
# test the IView request
r = self._createRequest()
- self.assertEquals(r.getPresentationType(), IHTTPPresentation)
self.assertEqual(r.getPresentationSkin(), '')
r.setPresentationSkin('morefoo')
self.assertEqual(r.getPresentationSkin(), 'morefoo')
=== Zope3/src/zope/publisher/tests/test_xmlrpcrequest.py 1.5 => 1.6 ===
--- Zope3/src/zope/publisher/tests/test_xmlrpcrequest.py:1.5 Fri Apr 11 08:55:41 2003
+++ Zope3/src/zope/publisher/tests/test_xmlrpcrequest.py Fri Nov 21 12:12:29 2003
@@ -14,7 +14,7 @@
import unittest
from zope.component.tests.placelesssetup import PlacelessSetup
-from zope.component.adapter import provideAdapter
+import zope.component
from zope.i18n.interfaces import IUserPreferredCharsets
@@ -24,7 +24,6 @@
from zope.publisher.xmlrpc import XMLRPCRequest
from zope.publisher.base import DefaultPublication
-from zope.publisher.interfaces.xmlrpc import IXMLRPCPresentation
from cStringIO import StringIO
@@ -70,7 +69,10 @@
def setUp(self):
PlacelessSetup.setUp(self)
- provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)
+
+ as = zope.component.getService(None, 'Adapters')
+ as.provideAdapter(IHTTPRequest, IUserPreferredCharsets, [HTTPCharsets])
+
class AppRoot:
" "
@@ -114,11 +116,6 @@
request = XMLRPCRequest(instream, outstream, env)
request.setPublication(publication)
return request
-
-
- def testIPresentationRequest(self):
- r = self._createRequest()
- self.failUnless(r.getPresentationType() is IXMLRPCPresentation)
def testProcessInput(self):
More information about the Zope3-Checkins
mailing list