Beispiel #1
0
    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(epigrass.__file__), '../templates'), os.path.join(os.path.dirname(epigrass.__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'] = "*****@*****.**"
Beispiel #2
0
    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(epigrass.__file__), '../templates'),
            os.path.join(os.path.dirname(epigrass.__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'] = "*****@*****.**"
Beispiel #3
0
import os, sys
# Third party libraries path must be fixed before importing webapp2
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'epigrass/external'))

import webapp2

import routes
from epigrass import routes as epigrass_routes
from admin import routes as admin_routes
from epigrass import config as epigrass_config
import config
from epigrass.lib.basehandler import handle_error

webapp2_config = epigrass_config.config
webapp2_config.update(config.config)

app = webapp2.WSGIApplication(debug=os.environ['SERVER_SOFTWARE'].startswith('Dev'), config=webapp2_config)

try:
    for status_int in app.config['error_templates']:
        app.error_handlers[status_int] = handle_error
except KeyError:
    pass

routes.add_routes(app)
epigrass_routes.add_routes(app)
admin_routes.add_routes(app)


Beispiel #4
0
import os, sys
# Third party libraries path must be fixed before importing webapp2
sys.path.insert(0, os.path.join(os.path.dirname(__file__),
                                'epigrass/external'))

import webapp2

import routes
from epigrass import routes as epigrass_routes
from admin import routes as admin_routes
from epigrass import config as epigrass_config
import config
from epigrass.lib.basehandler import handle_error

webapp2_config = epigrass_config.config
webapp2_config.update(config.config)

app = webapp2.WSGIApplication(
    debug=os.environ['SERVER_SOFTWARE'].startswith('Dev'),
    config=webapp2_config)

try:
    for status_int in app.config['error_templates']:
        app.error_handlers[status_int] = handle_error
except KeyError:
    pass

routes.add_routes(app)
epigrass_routes.add_routes(app)
admin_routes.add_routes(app)