[Checkins] SVN: zope.testbrowser/branches/jinty-webtest/src/zope/testbrowser/ Remove some uninteresting headers from the test.
Brian Sutherland
jinty at web.de
Wed Dec 15 11:47:42 EST 2010
Log message for revision 118937:
Remove some uninteresting headers from the test.
These headers are different between the WebTest and zope.app.testing
implementations of Browser and so can't really be tested in the same test. It
also looks like the intention of the test is not to test these specific
headers.
Changed:
U zope.testbrowser/branches/jinty-webtest/src/zope/testbrowser/README.txt
U zope.testbrowser/branches/jinty-webtest/src/zope/testbrowser/ftests/__init__.py
-=-
Modified: zope.testbrowser/branches/jinty-webtest/src/zope/testbrowser/README.txt
===================================================================
--- zope.testbrowser/branches/jinty-webtest/src/zope/testbrowser/README.txt 2010-12-15 16:40:42 UTC (rev 118936)
+++ zope.testbrowser/branches/jinty-webtest/src/zope/testbrowser/README.txt 2010-12-15 16:47:42 UTC (rev 118937)
@@ -1214,19 +1214,16 @@
method that allows a request body to be supplied. This method is particularly
helpful when testing Ajax methods.
-Let's visit a page that echos it's request:
+Let's visit a page that echos some interesting values from it's request:
>>> browser.open('http://localhost/@@echo.html')
>>> print browser.contents
HTTP_ACCEPT_LANGUAGE: en-US
HTTP_CONNECTION: close
- HTTP_COOKIE:
HTTP_HOST: localhost
HTTP_USER_AGENT: Python-urllib/2.4
PATH_INFO: /@@echo.html
- QUERY_STRING:
REQUEST_METHOD: GET
- SERVER_PROTOCOL: HTTP/1.1
Body: ''
Now, we'll try a post. The post method takes a URL, a data string,
@@ -1239,35 +1236,29 @@
CONTENT_TYPE: application/x-www-form-urlencoded
HTTP_ACCEPT_LANGUAGE: en-US
HTTP_CONNECTION: close
- HTTP_COOKIE:
HTTP_HOST: localhost
HTTP_USER_AGENT: Python-urllib/2.4
PATH_INFO: /@@echo.html
- QUERY_STRING:
REQUEST_METHOD: POST
- SERVER_PROTOCOL: HTTP/1.1
x: 1
y: 2
Body: ''
-
The body is empty because it is consumed to get form data.
We can pass a content-type explicitly:
>>> browser.post('http://localhost/@@echo.html',
... '{"x":1,"y":2}', 'application/x-javascipt')
- >>> print browser.contents # doctest: +REPORT_NDIFF
+ >>> print browser.contents
CONTENT_LENGTH: 13
CONTENT_TYPE: application/x-javascipt
HTTP_ACCEPT_LANGUAGE: en-US
HTTP_CONNECTION: close
- HTTP_COOKIE:
HTTP_HOST: localhost
HTTP_USER_AGENT: Python-urllib/2.4
PATH_INFO: /@@echo.html
REQUEST_METHOD: POST
- SERVER_PROTOCOL: HTTP/1.1
Body: '{"x":1,"y":2}'
Here, the body is left in place because it isn't form data.
Modified: zope.testbrowser/branches/jinty-webtest/src/zope/testbrowser/ftests/__init__.py
===================================================================
--- zope.testbrowser/branches/jinty-webtest/src/zope/testbrowser/ftests/__init__.py 2010-12-15 16:40:42 UTC (rev 118936)
+++ zope.testbrowser/branches/jinty-webtest/src/zope/testbrowser/ftests/__init__.py 2010-12-15 16:47:42 UTC (rev 118937)
@@ -22,13 +22,10 @@
'CONTENT_TYPE',
'HTTP_ACCEPT_LANGUAGE',
'HTTP_CONNECTION',
- 'HTTP_COOKIE',
'HTTP_HOST',
'HTTP_USER_AGENT',
'PATH_INFO',
- 'QUERY_STRING',
- 'REQUEST_METHOD',
- 'SERVER_PROTOCOL')
+ 'REQUEST_METHOD')
class Echo(View):
"""Simply echo the interesting parts of the request"""
More information about the checkins
mailing list