[Zope-Checkins]
SVN: Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/
Functional doctests now also set the cookie headers.
Stefan H. Holek
stefan at epy.co.at
Sun Sep 25 07:36:46 EDT 2005
Log message for revision 38610:
Functional doctests now also set the cookie headers.
Changed:
U Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
U Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/FunctionalDocTest.txt
U Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
U Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py
-=-
Modified: Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2005-09-25 08:45:18 UTC (rev 38609)
+++ Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2005-09-25 11:36:45 UTC (rev 38610)
@@ -4,6 +4,7 @@
than GET or HEAD while omitting the stdin argument.
- installProduct() now becomes a noop if ZopeTestCase did not apply its
patches.
+- Made the functional doc tests set the cookie related headers.
0.9.8 (Zope 2.8 edition)
- Renamed 'doctest' package to 'zopedoctest' because of name-shadowing
Modified: Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/FunctionalDocTest.txt
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/FunctionalDocTest.txt 2005-09-25 08:45:18 UTC (rev 38609)
+++ Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/FunctionalDocTest.txt 2005-09-25 11:36:45 UTC (rev 38610)
@@ -155,3 +155,27 @@
>>> self.folder.index_html.title_or_id()
'Baz'
+Test setting cookies
+
+ >>> print http(r"""
+ ... GET /test_folder_1_/index_html/set_cookie HTTP/1.1
+ ... """, handle_errors=False)
+ HTTP/1.1 200 OK
+ Content-Length: 0
+ ...
+ Set-Cookie: cookie_test="OK"
+ <BLANKLINE>
+
+Test reading cookies
+
+ >>> print http(r"""
+ ... GET /test_folder_1_/index_html/show_cookies HTTP/1.1
+ ... Cookie: foo=bar; baz="oki doki"
+ ... """, handle_errors=False)
+ HTTP/1.1 200 OK
+ Content-Length: 23
+ Content-Type: text/plain
+ <BLANKLINE>
+ foo: bar
+ baz: oki doki
+ <BLANKLINE>
Modified: Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py 2005-09-25 08:45:18 UTC (rev 38609)
+++ Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py 2005-09-25 11:36:45 UTC (rev 38610)
@@ -181,6 +181,7 @@
)
header_output.setResponseStatus(response.getStatus(), response.errmsg)
header_output.setResponseHeaders(response.headers)
+ header_output.appendResponseHeaders(response._cookie_list())
# Restore previous security manager, which may have been changed
# by calling the publish method above
Modified: Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py 2005-09-25 08:45:18 UTC (rev 38609)
+++ Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/zopedoctest/testFunctionalDocTest.py 2005-09-25 11:36:45 UTC (rev 38610)
@@ -12,7 +12,7 @@
##############################################################################
"""Example functional doctest
-$Id: testFunctionalDocTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
+$Id$
"""
import os, sys
@@ -47,7 +47,15 @@
change_title = '''<dtml-call "manage_changeProperties(title=REQUEST.get('title'))">'''
self.folder.addDTMLMethod('change_title', file=change_title)
+ set_cookie = '''<dtml-call "REQUEST.RESPONSE.setCookie('cookie_test', 'OK')">'''
+ self.folder.addDTMLMethod('set_cookie', file=set_cookie)
+ show_cookies = '''<dtml-in "REQUEST.cookies.keys()">
+<dtml-var sequence-item>: <dtml-var "REQUEST.cookies[_['sequence-item']]">
+</dtml-in>'''
+ self.folder.addDTMLMethod('show_cookies', file=show_cookies)
+
+
def test_suite():
return TestSuite((
FunctionalDocTestSuite(setUp=setUp),
More information about the Zope-Checkins
mailing list