This commit is contained in:
野間 2023-04-21 10:11:16 +09:00
parent d18caacc88
commit 0b05b04cab

View File

@ -3,7 +3,7 @@ from datetime import datetime
import pytest
from src.batch.common.batch_config import BatchConfig
from src.batch.common.batch_context import BatchContext
from src.batch.ultmarc.utmp_tables.table_mapper.concrete import com_pharm_mapper
from src.db.database import Database
from tests.testing_utility import (assert_table_results,
@ -18,13 +18,13 @@ class TestComPharmMapper:
""" レイアウト区分102: COM_薬局 """
db: Database
batch_config: BatchConfig
batch_context: BatchContext
test_file_path: str = path.dirname(__file__)
@pytest.fixture(autouse=True, scope='function')
def pre_test(self, database: Database):
""" テスト実行前後処理 """
self.batch_config = BatchConfig.get_instance()
self.batch_context = BatchContext.get_instance()
# setup
self.db = database
self.db.connect()
@ -50,7 +50,7 @@ class TestComPharmMapper:
# Arrange
# 処理日設定
self.batch_config.syor_date = datetime.strftime(datetime.now(), '%Y/%m/%d')
self.batch_context.syor_date = datetime.strftime(datetime.now(), '%Y/%m/%d')
# テスト用のCSVを読み込む
test_dat_file = create_ultmarc_test_data_from_csv(path.join(self.test_file_path, 'com_pharm_insert.csv'))
# 一旦全データをDBから削除
@ -95,7 +95,7 @@ class TestComPharmMapper:
# Arrange
# 処理日設定
self.batch_config.syor_date = datetime.strftime(datetime.now(), '%Y/%m/%d')
self.batch_context.syor_date = datetime.strftime(datetime.now(), '%Y/%m/%d')
# テスト用のCSVを読み込む
test_dat_file = create_ultmarc_test_data_from_csv(path.join(self.test_file_path, 'com_pharm_update.csv'))
# 一旦全データをDBから削除
@ -152,7 +152,7 @@ class TestComPharmMapper:
# Arrange
# 処理日設定
self.batch_config.syor_date = datetime.strftime(datetime.now(), '%Y/%m/%d')
self.batch_context.syor_date = datetime.strftime(datetime.now(), '%Y/%m/%d')
# テスト用のCSVを読み込む
test_dat_file = create_ultmarc_test_data_from_csv(path.join(self.test_file_path, 'com_pharm_delete.csv'))
# 一旦全データをDBから削除