def setUp(self): # create a WSGI application. webapp2_config = boilerplate_config.config webapp2_config.update(config.config) self.app = webapp2.WSGIApplication(config=webapp2_config) routes.add_routes(self.app) boilerplate_routes.add_routes(self.app) self.testapp = webtest.TestApp(self.app, extra_environ={'REMOTE_ADDR' : '127.0.0.1'}) # use absolute path for templates self.app.config['webapp2_extras.jinja2']['template_path'] = [os.path.join(os.path.dirname(justice.__file__), '../templates'), os.path.join(os.path.dirname(justice.__file__), 'templates')] # activate GAE stubs self.testbed = testbed.Testbed() self.testbed.activate() self.testbed.init_datastore_v3_stub() self.testbed.init_memcache_stub() self.testbed.init_urlfetch_stub() self.testbed.init_taskqueue_stub() self.testbed.init_mail_stub() self.mail_stub = self.testbed.get_stub(testbed.MAIL_SERVICE_NAME) self.taskqueue_stub = self.testbed.get_stub(testbed.TASKQUEUE_SERVICE_NAME) self.testbed.init_user_stub() self.headers = {'User-Agent' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) Version/6.0 Safari/536.25', 'Accept-Language' : 'en_US'} # fix configuration if this is still a raw epigrass code - required by test with mails if not utils.is_email_valid(self.app.config.get('contact_sender')): self.app.config['contact_sender'] = "*****@*****.**" if not utils.is_email_valid(self.app.config.get('contact_recipient')): self.app.config['contact_recipient'] = "*****@*****.**"
def setUp(self): # create a WSGI application. webapp2_config = boilerplate_config.config webapp2_config.update(config.config) self.app = webapp2.WSGIApplication(config=webapp2_config) routes.add_routes(self.app) boilerplate_routes.add_routes(self.app) self.testapp = webtest.TestApp( self.app, extra_environ={'REMOTE_ADDR': '127.0.0.1'}) # use absolute path for templates self.app.config['webapp2_extras.jinja2']['template_path'] = [ os.path.join(os.path.dirname(justice.__file__), '../templates'), os.path.join(os.path.dirname(justice.__file__), 'templates') ] # activate GAE stubs self.testbed = testbed.Testbed() self.testbed.activate() self.testbed.init_datastore_v3_stub() self.testbed.init_memcache_stub() self.testbed.init_urlfetch_stub() self.testbed.init_taskqueue_stub() self.testbed.init_mail_stub() self.mail_stub = self.testbed.get_stub(testbed.MAIL_SERVICE_NAME) self.taskqueue_stub = self.testbed.get_stub( testbed.TASKQUEUE_SERVICE_NAME) self.testbed.init_user_stub() self.headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) Version/6.0 Safari/536.25', 'Accept-Language': 'en_US' } # fix configuration if this is still a raw epigrass code - required by test with mails if not utils.is_email_valid(self.app.config.get('contact_sender')): self.app.config['contact_sender'] = "*****@*****.**" if not utils.is_email_valid(self.app.config.get('contact_recipient')): self.app.config[ 'contact_recipient'] = "*****@*****.**"
__author__ = 'Flavio C. Coelho (@fccoelho)' __website__ = 'fccoelho.github.com' import os, sys # Third party libraries path must be fixed before importing webapp2 sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'justice/external')) import webapp2 import routes from justice import routes as justice_routes from admin import routes as admin_routes from justice import config as justice_config import config from justice.lib.basehandler import handle_error webapp2_config = justice_config.config webapp2_config.update(config.config) app = webapp2.WSGIApplication( debug=os.environ['SERVER_SOFTWARE'].startswith('Dev'), config=webapp2_config) for status_int in app.config['error_templates']: app.error_handlers[status_int] = handle_error routes.add_routes(app) justice_routes.add_routes(app) admin_routes.add_routes(app)
__author__ = 'Flavio C. Coelho (@fccoelho)' __website__ = 'fccoelho.github.com' import os, sys # Third party libraries path must be fixed before importing webapp2 sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'justice/external')) import webapp2 import routes from justice import routes as justice_routes from admin import routes as admin_routes from justice import config as justice_config import config from justice.lib.basehandler import handle_error webapp2_config = justice_config.config webapp2_config.update(config.config) app = webapp2.WSGIApplication(debug = os.environ['SERVER_SOFTWARE'].startswith('Dev'), config=webapp2_config) for status_int in app.config['error_templates']: app.error_handlers[status_int] = handle_error routes.add_routes(app) justice_routes.add_routes(app) admin_routes.add_routes(app)