Part of lp.services.webapp.servers View In Hierarchy
Known subclasses: lp.services.webapp.servers.WebServiceTestRequest
>>> 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.
>>> lp.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
If force_fresh_login_for_testing is set to True, the lp.services.webapp.login.isFreshLogin function will always return True. This is useful in tests where you want to avoid needing a fresh login when exercising views such as PersonGPGView
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 | clearSecurityPolicyCache | See ILaunchpadBrowserApplicationRequest. |
Method | _createResponse | As per zope.publisher.browser.BrowserRequest._createResponse |
Inherited from LaunchpadBrowserRequestMixin:
Method | getRootURL | See IBasicLaunchpadRequest. |
Method | is_ajax | See IBasicLaunchpadRequest . |
Method | getURL | See IBasicLaunchpadRequest . |