def app(): """Return a session-wide application configured in TEST mode.""" # _app = create_app('testing') _app = Flask(__name__) _app.config.from_object(get_named_config('testing')) _db.init_app(_app) return _app
from flask import Flask # pylint: disable=wrong-import-order from account_mailer import config # pylint: disable=wrong-import-order from account_mailer.auth_utils import get_member_emails from account_mailer.email_processors import common_mailer # pylint: disable=wrong-import-order from account_mailer.email_processors import ejv_failures # pylint: disable=wrong-import-order from account_mailer.email_processors import pad_confirmation # pylint: disable=wrong-import-order from account_mailer.email_processors import payment_completed # pylint: disable=wrong-import-order from account_mailer.email_processors import refund_requested # pylint: disable=wrong-import-order from account_mailer.enums import MessageType, SubjectType, TemplateType from account_mailer.services import minio_service # pylint: disable=wrong-import-order from account_mailer.services import notification_service # pylint: disable=wrong-import-order qsm = QueueServiceManager() # pylint: disable=invalid-name APP_CONFIG = config.get_named_config(os.getenv('DEPLOYMENT_ENV', 'production')) FLASK_APP = Flask(__name__) FLASK_APP.config.from_object(APP_CONFIG) db.init_app(FLASK_APP) # pylint: disable=too-many-statements, too-many-branches async def process_event(event_message: dict, flask_app): """Process the incoming queue event message.""" if not flask_app: raise QueueException('Flask App not available.') with flask_app.app_context(): message_type = event_message.get('type', None) email_msg = event_message.get('data') email_msg['logo_url'] = minio_service.MinioService.get_minio_public_url('bc_logo_for_email.png')