webunit2.response

class webunit2.response.HttpResponse(response, content='')[source]

Creates an object out of the httplib2.Response, which is just a subclass of dict. Since we want to make the response a little easier to deal with, this class will objectify it.

response:
dictionary like object returned from an httplib2 request.
content:
Content returned in the body of the response.
assertCookie(name, value=None, attrs={}, *args, **kwargs)[source]

Returns True if:

  • the cookie name appears in the response
  • if value is not None, the values are equal
  • if any of the attributes match

For example, to check to see if the HttpOnly and path attribute are set:

assertCookie("cookie_name", attrs={'HttpOnly': True, "Path": "/"})
assertHeader(name, value=None, *args, **kwargs)[source]

Returns True if name was in the headers and, if value is True, whether or not the values match, or False otherwise.

assertInBody(content, *args, **kwargs)[source]

Returns True if content appears in the body of the response, False if not.

assertNotCookie(name, value=None, attrs={}, *args, **kwargs)[source]
assertNotHeader(name, value=None, *args, **kwargs)[source]
assertNotInBody(content, *args, **kwargs)[source]
assertNotStatus(status, *args, **kwargs)[source]
assertStatus(status, *args, **kwargs)[source]

Returns True if status was the status code received by this response, False if not.

Previous topic

webunit2.framework

Next topic

webunit2.testcase

This Page