def __init__(self, url=None, pagename=''): if url is None: url = 'http://localhost:0/' # just some somehow valid dummy URL environ = create_environ(base_url=url) # XXX not sure about base_url, but makes "make underlay" work environ['HTTP_USER_AGENT'] = 'CLI/Script' environ['wsgi.input'] = sys.stdin request = Request(environ) super(ScriptContext, self).__init__(request) from MoinMoin import wsgiapp wsgiapp.init(self)
def run_request(self, **params): request = TestRequest(**params) #XXX: config passing hack request.given_config = getattr(self, 'Config', wikiconfig.Config) context = wsgiapp.init(request) wsgiapp.run(context) return context
def init_test_request(given_config=None, static_state=[False]): if not static_state[0]: maketestwiki.run(True) static_state[0] = True request = TestRequest() request.given_config = given_config request = init(request) return request