[Zope3-checkins] SVN: Zope3/trunk/ Fixed issue #353 (applySkin does
not work in functional doctests).
Marius Gedminas
marius at pov.lt
Wed Feb 2 16:11:44 EST 2005
Log message for revision 29022:
Fixed issue #353 (applySkin does not work in functional doctests).
The problem was that zope.app.tests.functional.HTTPCaller applied the default
skin to the request class rather than request instance, and applySkin could
not strip it from the request.
Changed:
U Zope3/trunk/doc/CHANGES.txt
U Zope3/trunk/src/zope/app/ftests/test_functional.py
U Zope3/trunk/src/zope/app/publisher/xmlrpc/README.txt
U Zope3/trunk/src/zope/app/tests/functional.py
-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt 2005-02-02 19:48:13 UTC (rev 29021)
+++ Zope3/trunk/doc/CHANGES.txt 2005-02-02 21:11:44 UTC (rev 29022)
@@ -309,6 +309,8 @@
Bug Fixes
+ - Fixed issue #353 (applySkin does not work in functional doctests).
+
- Fixed issue #293 (SequenceWidget and CustomWidgetFactory).
- TextWidgets set the value attribute to "value" when the field
Modified: Zope3/trunk/src/zope/app/ftests/test_functional.py
===================================================================
--- Zope3/trunk/src/zope/app/ftests/test_functional.py 2005-02-02 19:48:13 UTC (rev 29021)
+++ Zope3/trunk/src/zope/app/ftests/test_functional.py 2005-02-02 21:11:44 UTC (rev 29022)
@@ -21,6 +21,7 @@
import transaction
from zope.app.tests.functional import SampleFunctionalTest, BrowserTestCase
from zope.app.tests.functional import FunctionalDocFileSuite
+from zope.app.tests.functional import FunctionalTestCase
class CookieFunctionalTest(BrowserTestCase):
@@ -121,10 +122,21 @@
self.assertEquals(response.getBody().strip(), 'aid=aval;bid=bval')
+class SkinsAndHTTPCaller(FunctionalTestCase):
+
+ def test_skins(self):
+ # Regression test for http://zope.org/Collectors/Zope3-dev/353
+ from zope.app.tests.functional import HTTPCaller
+ http = HTTPCaller()
+ response = http("GET /++skin++Basic HTTP/1.1\n\n")
+ self.assert_("zopetopBasic.css" in str(response))
+
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(SampleFunctionalTest))
suite.addTest(unittest.makeSuite(CookieFunctionalTest))
+ suite.addTest(unittest.makeSuite(SkinsAndHTTPCaller))
suite.addTest(FunctionalDocFileSuite('doctest.txt'))
return suite
Modified: Zope3/trunk/src/zope/app/publisher/xmlrpc/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/publisher/xmlrpc/README.txt 2005-02-02 19:48:13 UTC (rev 29021)
+++ Zope3/trunk/src/zope/app/publisher/xmlrpc/README.txt 2005-02-02 21:11:44 UTC (rev 29022)
@@ -43,7 +43,7 @@
Now, we'll add some items to the root folder:
>>> print http(r"""
- ... POST /++skin++Debug/@@contents.html HTTP/1.1
+ ... POST /@@contents.html HTTP/1.1
... Authorization: Basic bWdyOm1ncnB3
... Content-Length: 73
... Content-Type: application/x-www-form-urlencoded
Modified: Zope3/trunk/src/zope/app/tests/functional.py
===================================================================
--- Zope3/trunk/src/zope/app/tests/functional.py 2005-02-02 19:48:13 UTC (rev 29021)
+++ Zope3/trunk/src/zope/app/tests/functional.py 2005-02-02 21:11:44 UTC (rev 29022)
@@ -596,17 +596,13 @@
request_cls = factory(StringIO(), StringIO(), {}).__class__
publication_cls = SOAPPublication
else:
- request_cls = type(BrowserRequest.__name__,
- (BrowserRequest,),
- {})
- zope.interface.classImplements(request_cls, _getDefaultSkin())
+ request_cls = BrowserRequest
publication_cls = BrowserPublication
elif (method == 'POST' and is_xml):
request_cls = XMLRPCRequest
publication_cls = XMLRPCPublication
else:
- request_cls = type(BrowserRequest.__name__, (BrowserRequest,), {})
- zope.interface.classImplements(request_cls, _getDefaultSkin())
+ request_cls = BrowserRequest
publication_cls = BrowserPublication
else:
@@ -617,6 +613,9 @@
path, instream, outstream,
environment=environment,
request=request_cls, publication=publication_cls)
+ if request_cls is BrowserRequest:
+ # Only browser requests have skins
+ zope.interface.directlyProvides(request, _getDefaultSkin())
request.response.setHeaderOutput(header_output)
response = DocResponseWrapper(
request.response, outstream, path, header_output)
More information about the Zope3-Checkins
mailing list