[Checkins] SVN: zope.testbrowser/branches/3.5/ Disabled zope.testbrowser.testing.Browser.post method as it does not pass its tests.

Stefan H. Holek stefan at epy.co.at
Fri Dec 26 05:34:34 EST 2008


Log message for revision 94332:
  Disabled zope.testbrowser.testing.Browser.post method as it does not pass its tests.
  

Changed:
  U   zope.testbrowser/branches/3.5/CHANGES.txt
  U   zope.testbrowser/branches/3.5/src/zope/testbrowser/README.txt
  U   zope.testbrowser/branches/3.5/src/zope/testbrowser/browser.py

-=-
Modified: zope.testbrowser/branches/3.5/CHANGES.txt
===================================================================
--- zope.testbrowser/branches/3.5/CHANGES.txt	2008-12-26 02:44:03 UTC (rev 94331)
+++ zope.testbrowser/branches/3.5/CHANGES.txt	2008-12-26 10:34:33 UTC (rev 94332)
@@ -10,6 +10,9 @@
 - New lines are no longer stripped in XML and HTML code contained in a
   textarea; requires ClientForm >= 0.2.10 (LP #268139).
 
+- Disabled zope.testbrowser.testing.Browser.post method as it does not
+  pass its tests.
+
 3.5.1 (2008-10-10)
 ------------------
 

Modified: zope.testbrowser/branches/3.5/src/zope/testbrowser/README.txt
===================================================================
--- zope.testbrowser/branches/3.5/src/zope/testbrowser/README.txt	2008-12-26 02:44:03 UTC (rev 94331)
+++ zope.testbrowser/branches/3.5/src/zope/testbrowser/README.txt	2008-12-26 10:34:33 UTC (rev 94332)
@@ -1110,71 +1110,74 @@
 Submitting a posts body directly
 --------------------------------
 
-In addition to the open method, zope.testbrowser.testing.Browser has a ``post``
-method that allows a request body to be supplied.  This method is particularly
-helpful when testing Ajax methods.
+XXX: Commented out for 3.5.2
 
-Let's visit a page that echos it's request:
+#In addition to the open method, zope.testbrowser.testing.Browser has a ``post``
+#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:
+#
+#    >>> browser.open('http://localhost/@@echo.html')
+#    >>> print browser.contents,
+#    HTTP_USER_AGENT: Python-urllib/2.4
+#    HTTP_CONNECTION: close
+#    HTTP_COOKIE:
+#    HTTP_REFERER: localhost
+#    HTTP_ACCEPT_LANGUAGE: en-US
+#    REQUEST_METHOD: GET
+#    HTTP_HOST: localhost
+#    PATH_INFO: /@@echo.html
+#    SERVER_PROTOCOL: HTTP/1.1
+#    QUERY_STRING:
+#    Body: ''
+#
+#Now, we'll try a post.  The post method takes a URL, a data string,
+#and an optional content type.  If we just pass a string, then
+#a URL-encoded query string is assumed:
+#
+#    >>> browser.post('http://localhost/@@echo.html', 'x=1&y=2')
+#    >>> print browser.contents,
+#    CONTENT_LENGTH: 7
+#    HTTP_USER_AGENT: Python-urllib/2.4
+#    HTTP_CONNECTION: close
+#    HTTP_COOKIE:
+#    HTTP_REFERER: localhost
+#    HTTP_ACCEPT_LANGUAGE: en-US
+#    y: 2
+#    REQUEST_METHOD: POST
+#    HTTP_HOST: localhost
+#    PATH_INFO: /@@echo.html
+#    CONTENT_TYPE: application/x-www-form-urlencoded
+#    SERVER_PROTOCOL: HTTP/1.1
+#    QUERY_STRING:
+#    x: 1
+#    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,
+#    CONTENT_LENGTH: 13
+#    HTTP_USER_AGENT: Python-urllib/2.4
+#    HTTP_CONNECTION: close
+#    HTTP_COOKIE:
+#    HTTP_REFERER: localhost
+#    HTTP_ACCEPT_LANGUAGE: en-US
+#    REQUEST_METHOD: POST
+#    HTTP_HOST: localhost
+#    PATH_INFO: /@@echo.html
+#    CONTENT_TYPE: application/x-javascipt
+#    SERVER_PROTOCOL: HTTP/1.1
+#    Body: '{"x":1,"y":2}'
+#
+#Here, the body is left in place because it isn't form data.
 
-    >>> browser.open('http://localhost/@@echo.html')
-    >>> print browser.contents,
-    HTTP_USER_AGENT: Python-urllib/2.4
-    HTTP_CONNECTION: close
-    HTTP_COOKIE:
-    HTTP_REFERER: localhost
-    HTTP_ACCEPT_LANGUAGE: en-US
-    REQUEST_METHOD: GET
-    HTTP_HOST: localhost
-    PATH_INFO: /@@echo.html
-    SERVER_PROTOCOL: HTTP/1.1
-    QUERY_STRING:
-    Body: ''
 
-Now, we'll try a post.  The post method takes a URL, a data string,
-and an optional content type.  If we just pass a string, then
-a URL-encoded query string is assumed:
-
-    >>> browser.post('http://localhost/@@echo.html', 'x=1&y=2')
-    >>> print browser.contents,
-    CONTENT_LENGTH: 7
-    HTTP_USER_AGENT: Python-urllib/2.4
-    HTTP_CONNECTION: close
-    HTTP_COOKIE:
-    HTTP_REFERER: localhost
-    HTTP_ACCEPT_LANGUAGE: en-US
-    y: 2
-    REQUEST_METHOD: POST
-    HTTP_HOST: localhost
-    PATH_INFO: /@@echo.html
-    CONTENT_TYPE: application/x-www-form-urlencoded
-    SERVER_PROTOCOL: HTTP/1.1
-    QUERY_STRING:
-    x: 1
-    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,
-    CONTENT_LENGTH: 13
-    HTTP_USER_AGENT: Python-urllib/2.4
-    HTTP_CONNECTION: close
-    HTTP_COOKIE:
-    HTTP_REFERER: localhost
-    HTTP_ACCEPT_LANGUAGE: en-US
-    REQUEST_METHOD: POST
-    HTTP_HOST: localhost
-    PATH_INFO: /@@echo.html
-    CONTENT_TYPE: application/x-javascipt
-    SERVER_PROTOCOL: HTTP/1.1
-    Body: '{"x":1,"y":2}'
-
-Here, the body is left in place because it isn't form data.
-
 Performance Testing
 -------------------
 

Modified: zope.testbrowser/branches/3.5/src/zope/testbrowser/browser.py
===================================================================
--- zope.testbrowser/branches/3.5/src/zope/testbrowser/browser.py	2008-12-26 02:44:03 UTC (rev 94331)
+++ zope.testbrowser/branches/3.5/src/zope/testbrowser/browser.py	2008-12-26 10:34:33 UTC (rev 94332)
@@ -249,10 +249,11 @@
             if self.raiseHttpErrors and code >= 400:
                 raise urllib2.HTTPError(url, code, msg, self.headers, fp=None)
 
-    def post(self, url, data, content_type=None):
-        if content_type is not None:
-            data = {'body': data, 'content-type': content_type}
-        return self.open(url, data)
+    # XXX: Commented out for 3.5.2 as it does not pass its tests
+    #def post(self, url, data, content_type=None):
+    #    if content_type is not None:
+    #        data = {'body': data, 'content-type': content_type}
+    #    return self.open(url, data)
 
     def _start_timer(self):
         self.timer.start()



More information about the Checkins mailing list