def get_request(self, post_data, multipart): environ = test.generate_test_wsgi_environment(post_data, multipart) environ['REQUEST_URI'] = '/app-test/test-resource' environ['HTTP_HOST'] = '____basic-test-domain____:1234567' environ['SERVER_NAME'] = '____basic-test-domain____' environ['HTTP_PORT'] = '1234567' application = app.get_application(environ) self.failIf(application is None, "Didn't get an application object.") return app.configure_request(environ, application)
def get_request(self, request_path): environ = test.generate_test_wsgi_environment() environ['REQUEST_URI'] = request_path environ['HTTP_HOST'] = '____basic-test-domain____:1234567' environ['SERVER_NAME'] = '____basic-test-domain____' environ['HTTP_PORT'] = '1234567' application = app.get_application(environ) self.failIf(application is None, "Didn't get an application object.") req = app.configure_request(environ, application) return req
def test_load(self): """ A functional test for Application instantiation. This test attempts to load the basic test application defined in L{modu.sites.test_site} by creating a sample environ dict, passed to L{modu.web.app.get_application()}. """ environ = test.generate_test_wsgi_environment() environ['HTTP_HOST'] = 'not-a-valid-domain.com' environ['REQUEST_URI'] = '/' application = app.get_application(environ) self.failIf(application is not None, "Got an Application object when expecting None.") environ['HTTP_HOST'] = '____basic-test-domain____:1234567' environ['SERVER_NAME'] = '____basic-test-domain____' environ['HTTP_PORT'] = '1234567' environ['REQUEST_URI'] = '/app-test/test-resource' application = app.get_application(environ) self.failIf(application is None, "Didn't get an application object.")
def get_request(self): environ = test.generate_test_wsgi_environment() environ['REQUEST_URI'] = '/app-test/test-resource' environ['HTTP_HOST'] = '____basic-test-domain____:1234567' environ['SERVER_NAME'] = '____basic-test-domain____' environ['HTTP_PORT'] = '1234567' environ['REMOTE_ADDR'] = '127.0.0.1' application = app.get_application(environ) self.failIf(application is None, "Didn't get an application object.") req = app.configure_request(environ, application) req['modu.store'] = self.store return req
def get_request(self, uri, form_data={}, hostname='____basic-test-domain____'): """ The request generator for this TestCase. """ environ = test.generate_test_wsgi_environment(form_data) environ['REQUEST_URI'] = uri environ['HTTP_HOST'] = '%s:1234567' % hostname environ['SERVER_NAME'] = hostname environ['HTTP_PORT'] = '1234567' application = app.get_application(environ) self.failIf(application is None, "Didn't get an application object.") req = app.configure_request(environ, application) return req
def get_request(self, post_data={}, multipart=True): """ The request generator for this TestCase. This generator can also create multipart post data. """ environ = test.generate_test_wsgi_environment(post_data, multipart) environ['REQUEST_URI'] = '/app-test/test-resource' environ['HTTP_HOST'] = '____basic-test-domain____:1234567' environ['SERVER_NAME'] = '____basic-test-domain____' environ['HTTP_PORT'] = '1234567' application = app.get_application(environ) self.failIf(application is None, "Didn't get an application object.") req = app.configure_request(environ, application) return req
def get_release_request(hostname): env = { 'SERVER_NAME' : hostname, 'SERVER_PORT' : '80', 'PATH_INFO' : '/', 'SCRIPT_NAME' : '', 'wsgi.url_scheme' : 'https', } req = app.Request() application = app.get_application(env) if not(application): raise RuntimeError("Can't load application config.") application.make_immutable() req = app.configure_request(env, application) if(hasattr(application.site, 'configure_request')): application.site.configure_request(req) return req
def get_request(self, form_data={}): """ The request generator for this TestCase. This returns a Store-enabled request. """ environ = test.generate_test_wsgi_environment(form_data) environ['REQUEST_URI'] = '/app-test/test-resource' environ['HTTP_HOST'] = '____store-test-domain____:1234567' environ['SERVER_NAME'] = '____store-test-domain____' environ['HTTP_PORT'] = '1234567' application = app.get_application(environ) self.failIf(application is None, "Didn't get an application object.") req = app.configure_request(environ, application) req['modu.pool'] = dbapi.connect(application.db_url) req['modu.user'] = test.TestAdminUser() persist.activate_store(req) return req
def get_request(self, form_data={}): """ The request generator for this TestCase. This particular implementation will return a Request object that has had a store instance defined for it. """ environ = test.generate_test_wsgi_environment(form_data) environ['REQUEST_URI'] = '/app-test/test-resource' environ['HTTP_HOST'] = '____store-test-domain____:1234567' environ['SERVER_NAME'] = '____store-test-domain____' environ['HTTP_PORT'] = '1234567' application = app.get_application(environ) self.failIf(application is None, "Didn't get an application object.") req = app.configure_request(environ, application) req['modu.pool'] = dbapi.connect(application.db_url) req['modu.user'] = test.TestAdminUser() queue.activate_content_queue(req) persist.activate_store(req) return req