c.l.w.s.LaunchpadTestRequest(TestRequest, ErrorReportRequest, LaunchpadBrowserRequestMixin) : class documentation

Part of canonical.launchpad.webapp.servers View In Hierarchy

Known subclasses: canonical.launchpad.webapp.servers.WebServiceTestRequest, lp.vostok.browser.tests.request.VostokTestRequest

Implements interfaces: canonical.launchpad.interfaces.launchpad.IBasicLaunchpadRequest, canonical.launchpad.layers.LaunchpadLayer, canonical.launchpad.webapp.interfaces.INotificationRequest, zope.security.interfaces.IParticipation

Mock request for use in unit and functional tests.

>>> request = LaunchpadTestRequest(SERVER_URL='http://127.0.0.1/foo/bar')

This class subclasses TestRequest - the standard Mock request object used in unit tests

>>> isinstance(request, TestRequest)
True

It provides LaunchpadLayer and adds a mock INotificationRequest implementation.

>>> canonical.launchpad.layers.LaunchpadLayer.providedBy(request)
True
>>> INotificationRequest.providedBy(request)
True
>>> request.uuid == request.response.uuid
True
>>> request.notifications is request.response.notifications
True

It also provides the form_ng attribute that is available from LaunchpadBrowserRequest.

>>> from zope.interface.verify import verifyObject
>>> verifyObject(IBrowserFormNG, request.form_ng)
True

It also provides the query_string_params dict that is available from LaunchpadBrowserRequest.

>>> request = LaunchpadTestRequest(SERVER_URL='http://127.0.0.1/foo/bar',
...     QUERY_STRING='a=1&b=2&c=3')
>>> request.charsets = ['utf-8']
>>> request.query_string_params == {'a': ['1'], 'b': ['2'], 'c': ['3']}
True

It also provides the hooks for popup calendar iframes:

>>> request.needs_datetimepicker_iframe
False
>>> request.needs_datepicker_iframe
False

And for JSON:

>>> request.needs_json
False
Method __init__ Undocumented
Method uuid Undocumented
Method notifications See INotificationRequest.
Method stepstogo See IBasicLaunchpadRequest.
Method getNearest See IBasicLaunchpadRequest.
Method setInWSGIEnvironment See IBasicLaunchpadRequest.
Method form_ng See ILaunchpadBrowserApplicationRequest.
Method query_string_params See ILaunchpadBrowserApplicationRequest.
Method setPrincipal See IPublicationRequest.
Method _createResponse As per zope.publisher.browser.BrowserRequest._createResponse

Inherited from LaunchpadBrowserRequestMixin:

Method getRootURL See IBasicLaunchpadRequest.
def __init__(self, body_instream=None, environ=None, form=None, skin=None, outstream=None, method='GET', **kw):
Undocumented
@property
def uuid(self):
Undocumented
@property
def notifications(self):
See INotificationRequest.
@property
def stepstogo(self):
See IBasicLaunchpadRequest.
def getNearest(self, *some_interfaces):
See IBasicLaunchpadRequest.
def setInWSGIEnvironment(self, key, value):
See IBasicLaunchpadRequest.
def _createResponse(self):
As per zope.publisher.browser.BrowserRequest._createResponse
@property
def form_ng(self):
See ILaunchpadBrowserApplicationRequest.
@property
def query_string_params(self):
See ILaunchpadBrowserApplicationRequest.
def setPrincipal(self, principal):
See IPublicationRequest.
API Documentation for Launchpad, generated by pydoctor at 2010-09-27 00:00:11.