Commit e87343e1 authored by Stefan H. Holek's avatar Stefan H. Holek

Functional doctests now also set the cookie headers.

parent 1da7e7dd
...@@ -4,6 +4,7 @@ Unreleased ...@@ -4,6 +4,7 @@ Unreleased
than GET or HEAD while omitting the stdin argument. than GET or HEAD while omitting the stdin argument.
- installProduct() now becomes a noop if ZopeTestCase did not apply its - installProduct() now becomes a noop if ZopeTestCase did not apply its
patches. patches.
- Made the functional doc tests set the cookie related headers.
0.9.8 (Zope 2.8 edition) 0.9.8 (Zope 2.8 edition)
- Renamed 'doctest' package to 'zopedoctest' because of name-shadowing - Renamed 'doctest' package to 'zopedoctest' because of name-shadowing
......
...@@ -155,3 +155,27 @@ Test passing in non-base64-encoded login/pass ...@@ -155,3 +155,27 @@ Test passing in non-base64-encoded login/pass
>>> self.folder.index_html.title_or_id() >>> self.folder.index_html.title_or_id()
'Baz' '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>
...@@ -182,6 +182,7 @@ def http(request_string, handle_errors=True): ...@@ -182,6 +182,7 @@ def http(request_string, handle_errors=True):
) )
header_output.setResponseStatus(response.getStatus(), response.errmsg) header_output.setResponseStatus(response.getStatus(), response.errmsg)
header_output.setResponseHeaders(response.headers) header_output.setResponseHeaders(response.headers)
header_output.appendResponseHeaders(response._cookie_list())
# Restore previous security manager, which may have been changed # Restore previous security manager, which may have been changed
# by calling the publish method above # by calling the publish method above
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
############################################################################## ##############################################################################
"""Example functional doctest """Example functional doctest
$Id: testFunctionalDocTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $ $Id$
""" """
import os, sys import os, sys
...@@ -47,6 +47,14 @@ def setUp(self): ...@@ -47,6 +47,14 @@ def setUp(self):
change_title = '''<dtml-call "manage_changeProperties(title=REQUEST.get('title'))">''' change_title = '''<dtml-call "manage_changeProperties(title=REQUEST.get('title'))">'''
self.folder.addDTMLMethod('change_title', file=change_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(): def test_suite():
return TestSuite(( return TestSuite((
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment