Beispiel #1
0
def make_request(method, path):
    req = Request(FakeChannel(), None)
    req.prepath = req.postpath = None
    req.method = method
    req.path = path
    resource = site.getChildWithDefault(path, req)
    return resource.render(req)
Beispiel #2
0
def makeRequest(method, path, post_data=None):
    req = Request(FakeChannel(), None)
    req.prepath = req.postpath = None
    req.method = method
    req.path = path
    req.content = StringIO(post_data)
    resource = site.getChildWithDefault(path, req)
    return resource.render(req)
Beispiel #3
0
def mk_request(path=None, headers=None):
    request = Request(channel=None, queued=True)
    if path:
        request.path = path
    if headers:
        for k, v in headers.items():
            request.requestHeaders.addRawHeader(k, v)
    return request
Beispiel #4
0
def getRequest(method, url):
    import warnings
    msg = 'These tests will be removed in a future release of the txrestserver'
    warnings.warn(msg, DeprecationWarning)

    req = Request(FakeChannel(), None)
    req.method = method
    req.path = url
    return req
Beispiel #5
0
    def get_request(self, method, uri, clientproto, headers, data, response):
        self.transport = response.transport

        r = Request(self, False)
        r.method = method
        r.clientproto = clientproto
        r.path = uri
        r.client = response.client
        r.host = self.host
        r.prepath = []
        r.postpath = map(unquote, string.split(r.path[1:], "/"))
        r.content = StringIO.StringIO(data)
        r.transport = response.transport

        return r
Beispiel #6
0
def getRequest(method, url):
    req = Request(FakeChannel(), None)
    req.method = method
    req.path = url
    return req