twisted.web.test.requesthelper.DummyRequest(object) class documentationtwisted.web.test.requesthelper
(View In Hierarchy)
Known subclasses: twisted.web.test.test_web.DummyRequestForLogTest
Represents a dummy or fake request. See twisted.web.server.Request.
| Instance Variable | requestheaders | A Headers instance that stores values for all request headers. (type: Headers) | 
| Instance Variable | responseHeaders | A Headers instance that stores values for all response headers. (type: Headers) | 
| Instance Variable | responseCode | The response code which was passed to setResponseCode. (type:int) | 
| Instance Variable | written | The bytes which have been written to the request. (type: listofbytes) | 
| Method | registerProducer | Call an IPullProducer'sresumeProducingmethod in a loop until it unregisters 
itself. | 
| Method | unregisterProducer | Undocumented | 
| Method | __init__ | Undocumented | 
| Method | getAllHeaders | Return dictionary mapping the names of all received headers to the last value received for each. | 
| Method | getHeader | Retrieve the value of a request header. | 
| Method | setHeader | TODO: make this assert on write() if the header is content-length | 
| Method | getSession | Undocumented | 
| Method | render | Render the given resource as a response to this request. | 
| Method | write | Undocumented | 
| Method | notifyFinish | Return a Deferredwhich
is called back withNonewhen the request is finished.  This will probably only work if you haven't 
calledfinishyet. | 
| Method | finish | Record that the request is finished and callback and Deferreds 
waiting for notification of this. | 
| Method | processingFailed | Errback and Deferredswaiting for finish notification. | 
| Method | addArg | Undocumented | 
| Method | setResponseCode | Set the HTTP status response code, but takes care that this is called before any data is written. | 
| Method | setLastModified | Undocumented | 
| Method | setETag | Undocumented | 
| Method | getClientIP | Return the IPv4 address of the client which made this request, if there 
is one, otherwise None. | 
| Method | getClientAddress | Return the IAddressof the client that made this request. | 
| Method | getRequestHostname | Get a dummy hostname associated to the HTTP request. | 
| Method | getHost | Get a dummy transport's host. | 
| Method | setHost | Change the host and port the request thinks it's using. | 
| Method | redirect | Utility function that does a redirect. | 
| Instance Variable | _finishedDeferreds | Noneor alistofDeferredswhich will be called back 
withNonewhenfinishis called or which will be errbacked ifprocessingFailedis called. | 
Call an IPullProducer's
resumeProducing method in a loop until it unregisters 
itself.
| Parameters | prod | The producer. (type: IPullProducer) | 
| s | Whether or not the producer is streaming. | 
Return dictionary mapping the names of all received headers to the last value received for each.
Since this method does not return all header information, 
self.requestHeaders.getAllRawHeaders() may be preferred.
NOTE: This function is a direct copy of 
twisted.web.http.Request.getAllRawHeaders.
Retrieve the value of a request header.
| Parameters | name | The name of the request header for which to retrieve the value.  Header 
names are compared case-insensitively. (type: bytes) | 
| Returns | The value of the specified request header. (type: bytesorNone) | |
Render the given resource as a response to this request.
This implementation only handles a few of the most common behaviors of 
resources.  It can handle a render method that returns a string or 
NOT_DONE_YET.  It doesn't know anything about the semantics of
request methods (eg HEAD) nor how to set any particular headers. Basically,
it's largely broken, but sufficient for some tests at least. It should 
not be expanded to do all the same stuff Request does. 
Instead, DummyRequest
should be phased out and Request (or some other real code 
factored in a different way) used.
Record that the request is finished and callback and Deferreds 
waiting for notification of this.
Set the HTTP status response code, but takes care that this is called before any data is written.
Return the IPv4 address of the client which made this request, if there 
is one, otherwise None.
Get a dummy hostname associated to the HTTP request.
| Returns | a dummy hostname (type: bytes) | |
Change the host and port the request thinks it's using.
| Parameters | host | The value to which to change the host header. (type: bytes) | 
| ssl | A flag which, if True, indicates that the request is 
considered secure (ifTrue,isSecurewill returnTrue). (type:bool) |