Merge pull request #89 feature-NEWDWH2021-680 into develop-6crm

This commit is contained in:
下田雅人 2022-08-29 09:07:58 +09:00
commit 551224f11f
3 changed files with 13 additions and 6 deletions

View File

@ -34,9 +34,9 @@ def prepare_data_fetch_process():
try:
# ③ S3 設定ファイル保管用バケットから、CRM_取得オブジェクト情報ファイルを取得する
object_info_file_s3_path = f's3://{CRM_CONFIG_BUCKET}{OBJECT_INFO_FOLDER}/{OBJECT_INFO_FILENAME}'
logger.debug(
f'D-PRE-03 CRM_取得オブジェクト情報ファイルの取得開始します ファイルパス:[{object_info_file_s3_path}]')
object_info_file_s3_path = f's3://{CRM_CONFIG_BUCKET}/{OBJECT_INFO_FOLDER}/{OBJECT_INFO_FILENAME}'
logger.info(
f'I-PRE-03 CRM_取得オブジェクト情報ファイルの取得開始します ファイルパス:[{object_info_file_s3_path}]')
config_bucket = ConfigBucket()
object_info_file_str = config_bucket.get_object_info_file()

View File

@ -7,6 +7,9 @@ from src.config.objects import FetchTargetObjects
from src.error.exceptions import FileNotFoundException, InvalidConfigException
from src.prepare_data_fetch_process import prepare_data_fetch_process
from src.system_var.constants import PRE_JP_NAME, YYYYMMDDTHHMMSSTZ
from src.system_var.environments import (CRM_CONFIG_BUCKET,
OBJECT_INFO_FILENAME,
OBJECT_INFO_FOLDER)
from .test_utils.log_message import generate_log_message_tuple
@ -80,6 +83,8 @@ class TestPrepareDataFetchProcess:
# ログの確認
assert generate_log_message_tuple(log_message='I-PRE-01 データ取得準備処理を開始します') in caplog.record_tuples
assert generate_log_message_tuple(log_message=f'I-PRE-02 データ取得処理開始日時:{str(actual_execute_datetime)}') in caplog.record_tuples
assert generate_log_message_tuple(
log_message=f'I-PRE-03 CRM_取得オブジェクト情報ファイルの取得開始します ファイルパス:[s3://{CRM_CONFIG_BUCKET}/{OBJECT_INFO_FOLDER}/{OBJECT_INFO_FILENAME}]') in caplog.record_tuples
assert generate_log_message_tuple(log_message='I-PRE-09 データ取得準備処理を終了します') in caplog.record_tuples
def test_call_depended_modules(self):

View File

@ -104,7 +104,7 @@ def test_walk_through(s3_test, s3_client, monkeypatch, caplog):
# Act
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logger.setLevel(logging.DEBUG)
logger.info(f'##########################')
logger.info(f'# 差分データ取得処理:実行開始 #')
logger.info(f'##########################')
@ -117,7 +117,7 @@ def test_walk_through(s3_test, s3_client, monkeypatch, caplog):
# ループ前のログ確認
assert 'I-CTRL-01 CRMデータ取得処理を開始します' in log_messages
assert 'I-CTRL-02 データ取得準備処理呼び出し' in log_messages
assert_prepare_process_log(log_messages, now)
assert_prepare_process_log(log_messages, now, path.basename(object_info_list[0]))
assert 'I-CTRL-03 取得対象オブジェクトのループ処理開始' in log_messages
# オブジェクト情報を取得する(diff)
object_info_list = object_info_files[0]
@ -206,9 +206,10 @@ def test_walk_through(s3_test, s3_client, monkeypatch, caplog):
"""
def assert_prepare_process_log(log_messages, now):
def assert_prepare_process_log(log_messages, now, object_info_list_filename):
assert 'I-PRE-01 データ取得準備処理を開始します' in log_messages
assert f'I-PRE-02 データ取得処理開始日時:{now}' in log_messages
assert f'I-PRE-03 CRM_取得オブジェクト情報ファイルの取得開始します ファイルパス:[s3://{CONFIG_BUCKET}/{OBJECT_INFO_FOLDER}/{object_info_list_filename}]' in log_messages
assert 'I-PRE-09 データ取得準備処理を終了します' in log_messages
@ -308,3 +309,4 @@ def set_environment(monkeypatch):
monkeypatch.setattr('src.aws.s3.CRM_IMPORT_DATA_BACKUP_FOLDER', BACKUP_DATA_IMPORT_FOLDER)
monkeypatch.setattr('src.aws.s3.PROCESS_RESULT_FOLDER', BACKUP_DATA_IMPORT_FOLDER)
monkeypatch.setattr('src.aws.s3.RESPONSE_JSON_BACKUP_FOLDER', BACKUP_RESPONSE_JSON_FOLDER)
monkeypatch.setattr('src.prepare_data_fetch_process.CRM_CONFIG_BUCKET', CONFIG_BUCKET)