def MyRequest(method='GET', path=site_path, user=agent, params={}): """ Construct a fake request(WSGIRequest) object""" req = WSGIRequest({ 'REQUEST_METHOD': method, 'PATH_INFO': path, 'wsgi.input': StringIO() }) req.user = user req.content_params = params return req