def setUp(self): self.app = Flask(__name__) self.test_client = self.app.test_client() self.init_logging() self.init_validator_context() self.config = TEST_CONFIG self.auth_cookie = None load_filters(self.app.jinja_env, self.config) self.app_context = self.app.app_context() self.app_context.__enter__() set_template_loader(self.app.jinja_env) init_configuration(self.app, self.config) init_blueprints(self.app) init_services(self.app) init_login_system(self.app) init_db(self.app) init_plugins() self.mailer = celery.conf['MAILER'] self.mailer.mails = [] self.sms_sender = celery.conf['SMS_SENDER'] self.sms_sender.sms = [] self.user = None self.user_profile = None UserManager.init(self.config, self.app.logger) sql_db.init_app(self.app) sql_db.create_all() for table in reversed(sql_db.metadata.sorted_tables): sql_db.engine.execute(table.delete()) @self.app.errorhandler(413) def catcher(error): data_json = json.dumps({ "error": { "code": errors.FileToLarge.ERROR_CODE, "message": errors.FileToLarge.ERROR_MESSAGE } }) result = Response(data_json, mimetype='application/json', status=400) result.headers.add('Access-Control-Allow-Credentials', "true") result.headers.add('Access-Control-Allow-Origin', "http://%s" % self.config['site_domain']) return result
def setUp(self): self.app = Flask(__name__) self.test_client = self.app.test_client() self.init_logging() self.init_validator_context() self.config = TEST_CONFIG self.auth_cookie = None load_filters(self.app.jinja_env, self.config) self.app_context = self.app.app_context() self.app_context.__enter__() set_template_loader(self.app.jinja_env) init_configuration(self.app, self.config) init_blueprints(self.app) init_services(self.app) init_login_system(self.app) init_db(self.app) init_plugins() self.mailer = celery.conf['MAILER'] self.mailer.mails = [] self.sms_sender = celery.conf['SMS_SENDER'] self.sms_sender.sms = [] self.user = None self.user_profile = None UserManager.init(self.config, self.app.logger) sql_db.init_app(self.app) sql_db.create_all() for table in reversed(sql_db.metadata.sorted_tables): sql_db.engine.execute(table.delete()) @self.app.errorhandler(413) def catcher(error): data_json = json.dumps({"error": {"code": errors.FileToLarge.ERROR_CODE, "message": errors.FileToLarge.ERROR_MESSAGE}}) result = Response(data_json, mimetype='application/json', status=400) result.headers.add('Access-Control-Allow-Credentials', "true") result.headers.add('Access-Control-Allow-Origin', "http://%s" % self.config['site_domain']) return result
load_filters(app.jinja_env, app.config) set_template_loader(app.jinja_env) init_blueprints(app) init_services(app) init_sql_db(app) init_plugins() init_flask_signals() #noinspection PyUnresolvedReferences init_login_system(app, app.config) app.secret_key = app.config['secret_key'] from fw.auth.user_manager import UserManager UserManager.init(app.config, app.logger) @app.errorhandler(413) def catcher(error): data_json = json.dumps({ "error": { "code": errors.FileToLarge.ERROR_CODE, "message": errors.FileToLarge.ERROR_MESSAGE } }) result = Response(data_json, mimetype='application/json', status=400) result.headers.add('Access-Control-Allow-Credentials', "true") result.headers.add('Access-Control-Allow-Origin', "http://%s" % app.config['site_domain']) return result
load_filters(app.jinja_env, app.config) set_template_loader(app.jinja_env) init_blueprints(app) init_services(app) init_sql_db(app) init_plugins() init_flask_signals() #noinspection PyUnresolvedReferences init_login_system(app, app.config) app.secret_key = app.config['secret_key'] from fw.auth.user_manager import UserManager UserManager.init(app.config, app.logger) @app.errorhandler(413) def catcher(error): data_json = json.dumps( {"error": {"code": errors.FileToLarge.ERROR_CODE, "message": errors.FileToLarge.ERROR_MESSAGE}}) result = Response(data_json, mimetype='application/json', status=400) result.headers.add('Access-Control-Allow-Credentials', "true") result.headers.add('Access-Control-Allow-Origin', "http://%s" % app.config['site_domain']) return result @app.context_processor def inject_user(): return dict(js_scripts_suffix=u".min" if not app.production else u"")