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 datetime import datetime import nats from auth_api.models import Org as OrgModel from auth_api.models import db from auth_api.services.queue_publisher import publish from auth_api.utils.enums import OrgStatus from entity_queue_common.service import QueueServiceManager from entity_queue_common.service_utils import QueueException, logger from flask import Flask # pylint: disable=wrong-import-order from sentry_sdk import capture_message from events_listener import config 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) UNLOCK_ACCOUNT_MESSAGE_TYPE = 'bc.registry.payment.unlockAccount' LOCK_ACCOUNT_MESSAGE_TYPE = 'bc.registry.payment.lockAccount' async def process_event(event_message, flask_app): """Render the org status.""" if not flask_app: raise QueueException('Flask App not available.') with flask_app.app_context(): message_type = event_message.get('type', None)