Example #1
0
    def setUp(self):

        webapp2_config = config_boilerplate.config
        webapp2_config.update(config_theme.config)
        # create a WSGI application.
        self.app = webapp2.WSGIApplication(config=webapp2_config)
        routes_boilerplate.add_routes(self.app)
        routes_theme.add_routes(self.app)
        self.testapp = webtest.TestApp(self.app, extra_environ={'REMOTE_ADDR' : '127.0.0.1'})

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

import webapp2

from bp_includes.lib.error_handler import handle_error
from bp_includes import config as config_boilerplate

sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'bp_content/themes/', os.environ['theme']))
# Import Config Importing
import config as config_theme

# Routes Importing
from bp_admin import routes as routes_admin
from bp_includes import routes as routes_boilerplate
import routes as routes_theme

webapp2_config = config_boilerplate.config
webapp2_config.update(config_theme.config)

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

if not app.debug:
    for status_int in app.config['error_templates']:
        app.error_handlers[status_int] = handle_error

routes_theme.add_routes(app)
routes_boilerplate.add_routes(app)
routes_admin.add_routes(app)
Example #3
0
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'bp_includes/external'))

import webapp2


from bp_includes.lib.error_handler import handle_error
from bp_includes import config as config_boilerplate

sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'bp_content/themes/', os.environ['theme']))
# Import Config Importing
import config as config_theme

# Routes Importing
from bp_admin import routes as routes_admin
from bp_includes import routes as routes_boilerplate
import routes as routes_theme


webapp2_config = config_boilerplate.config
webapp2_config.update(config_theme.config)

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

if not app.debug:
    for status_int in app.config['error_templates']:
        app.error_handlers[status_int] = handle_error

routes_theme.add_routes(app)
routes_boilerplate.add_routes(app)
routes_admin.add_routes(app)