From bc9f41ed3e67ed0350951de62331b3cd87c6aa78 Mon Sep 17 00:00:00 2001 From: efiacor Date: Wed, 12 Feb 2020 23:31:16 +0000 Subject: Fix PMHS logs dir setup # Refactoring test|prod init Signed-off-by: efiacor Change-Id: Ib073cb762a7750fca7bdf415cf5080d04f7bda51 Issue-ID: DCAEGEN2-2078 --- .../pm-subscription-handler/pmsh_service/mod/__init__.py | 14 +------------- .../pm-subscription-handler/pmsh_service/pmsh_service.py | 4 ++-- 2 files changed, 3 insertions(+), 15 deletions(-) (limited to 'components/pm-subscription-handler/pmsh_service') diff --git a/components/pm-subscription-handler/pmsh_service/mod/__init__.py b/components/pm-subscription-handler/pmsh_service/mod/__init__.py index f8b1c598..722188ae 100644 --- a/components/pm-subscription-handler/pmsh_service/mod/__init__.py +++ b/components/pm-subscription-handler/pmsh_service/mod/__init__.py @@ -27,7 +27,7 @@ db = SQLAlchemy() basedir = os.path.abspath(os.path.dirname(__file__)) -def create_prod_app(): +def create_app(): logger.create_loggers(os.getenv('LOGS_PATH')) connex_app = App(__name__, specification_dir=basedir) app = connex_app.app @@ -38,18 +38,6 @@ def create_prod_app(): return app -def create_test_app(): - logger.create_loggers('./unit_test_logs') - connex_app = App(__name__, specification_dir=basedir) - app = connex_app.app - app.config['TESTING'] = True - app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False - app.config['SQLALCHEMY_RECORD_QUERIES'] = True - app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('TEST_DB_URL', 'sqlite://') - db.init_app(app) - return app - - def get_db_connection_url(): pg_host = os.getenv('PMSH_PG_URL') pg_user = os.getenv('PMSH_PG_USERNAME') diff --git a/components/pm-subscription-handler/pmsh_service/pmsh_service.py b/components/pm-subscription-handler/pmsh_service/pmsh_service.py index 99689d01..c564a5e3 100755 --- a/components/pm-subscription-handler/pmsh_service/pmsh_service.py +++ b/components/pm-subscription-handler/pmsh_service/pmsh_service.py @@ -20,7 +20,7 @@ import time import mod.aai_client as aai_client import mod.pmsh_logging as logger -from mod import db, create_prod_app +from mod import db, create_app from mod.config_handler import ConfigHandler from mod.subscription import Subscription @@ -28,7 +28,7 @@ from mod.subscription import Subscription def main(): try: - app = create_prod_app() + app = create_app() app.app_context().push() db.create_all(app=app) -- cgit 1.2.3-korg