TestResponse¶
│ │ │ -The response object is based on webob.response.Response
with some additions
│ │ │ +
The response object is based on webob.response.Response
with some additions
│ │ │ to help with testing.
The inherited attributes that are most interesting:
│ │ │-
│ │ │
response.status
:The text status of the response, e.g.,
│ │ │"200 OK"
.
│ │ │ response.status_int
:The text status_int of the response, e.g.,
│ │ │200
.
│ │ │ @@ -43,15 +43,15 @@
│ │ │
│ │ │ response.body
:The text body of the response.
│ │ │
│ │ │ response.text
:The unicode text body of the response.
│ │ │
│ │ │ response.normal_body
:The whitespace-normalized 1 body of the response.
│ │ │
│ │ │ -response.request
:The
webob.request.BaseRequest
object used to generate │ │ │ +response.request
:The
│ │ │webob.request.BaseRequest
object used to generate │ │ │ this response.
│ │ │
The added methods:
│ │ │-
│ │ │
response.follow(**kw)
:Follows the redirect, returning the new response. It is an error │ │ │ if this response wasn't a redirect. All keyword arguments are │ │ │ @@ -72,15 +72,15 @@ │ │ │ response. It also prints out the response in that case, so you │ │ │ can see the real response.
│ │ │
│ │ │ response.showbrowser()
:Opens the HTML response in a browser; useful for debugging.
│ │ │
│ │ │ str(response)
:Gives a slightly-compacted version of the response. This is │ │ │ compacted to remove newlines, making it easier to use with │ │ │ -
│ │ │ +doctest
.doctest
. │ │ │
│ │ │ response.click(description=None, linkid=None, href=None, anchor=None, index=None, verbose=False)
:Clicks the described link (see
│ │ │click()
)
│ │ │ response.forms
:Return a dictionary of forms; you can use both indexes (refer to │ │ │ the forms in order) or the string ids of forms (if you've given │ │ │ them ids) to identify the form. See Form handling for more on the form │ │ │ objects.
│ │ │ @@ -124,15 +124,15 @@ │ │ │ >>> res.html │ │ │ <html><body><div id="content">hey!</div></body></html> │ │ │ >>> res.html.__class__ │ │ │ <class '...BeautifulSoup'> │ │ │