feat: モジュール振り分け処理のテスト実装
This commit is contained in:
parent
3ceee58260
commit
5fe6697926
@ -5,7 +5,7 @@ name = "pypi"
|
||||
|
||||
[scripts]
|
||||
"test" = "pytest tests -vvv"
|
||||
"test:cov" = "pytest --cov=src/manager/ --cov-branch --cov-report=term-missing tests/"
|
||||
"test:cov" = "pytest --cov=src/manager/ --cov=src/batch/common --cov-branch --cov-report=term-missing tests/"
|
||||
|
||||
[packages]
|
||||
boto3 = "*"
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
from src.batch.update_business_day import UpdateBusinessDay
|
||||
from src.batch.jskult_batch_entrypoint import JskultBatchEntrypoint
|
||||
from src.batch.trn_result_data_bio_lot import TrnResultDataBioLot
|
||||
from src.batch.mst_inst import MstInst
|
||||
from src.batch.dcf_inst_merge_io import DcfInstMergeIO
|
||||
|
||||
from src.batch.jskult_batch_entrypoint import JskultBatchEntrypoint
|
||||
from src.batch.mst_inst import MstInst
|
||||
from src.batch.trn_result_data_bio_lot import TrnResultDataBioLot
|
||||
from src.batch.update_business_day import UpdateBusinessDay
|
||||
from src.error.exceptions import BatchOperationException
|
||||
from src.logging.get_logger import get_logger
|
||||
|
||||
logger = get_logger("後続処理/日付更新処理振り分け")
|
||||
@ -18,7 +18,7 @@ class JskultBatchEntrypointFactory:
|
||||
|
||||
if self._entrypoint_module_name == "jskult-batch-trn-result-data-bio-lot":
|
||||
return TrnResultDataBioLot()
|
||||
if self._entrypoint_module_name == "jskult-batch-mst-inst":
|
||||
if self._entrypoint_module_name == "jskult-batch-mst-inst-all":
|
||||
return MstInst()
|
||||
if self._entrypoint_module_name == "jskult-batch-dcf-inst-merge-io":
|
||||
return DcfInstMergeIO()
|
||||
@ -27,4 +27,4 @@ class JskultBatchEntrypointFactory:
|
||||
|
||||
logger.error(
|
||||
f"一致するエントリーポイント識別子ではありませんでした。エントリーポイント識別子:{self._entrypoint_module_name}")
|
||||
raise ValueError()
|
||||
raise BatchOperationException()
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import abc
|
||||
|
||||
# 実消化&アルトマークの後続処理/日付更新実行クラスの基底クラス
|
||||
|
||||
|
||||
class JskultBatchEntrypoint(metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod()
|
||||
@abc.abstractmethod
|
||||
def execute(self):
|
||||
pass
|
||||
|
||||
0
ecs/jskult-batch/tests/batch/__init__.py
Normal file
0
ecs/jskult-batch/tests/batch/__init__.py
Normal file
0
ecs/jskult-batch/tests/batch/common/__init__.py
Normal file
0
ecs/jskult-batch/tests/batch/common/__init__.py
Normal file
@ -0,0 +1,56 @@
|
||||
import pytest
|
||||
|
||||
from src.batch.common.jskult_batch_entrypoint_factory import \
|
||||
JskultBatchEntrypointFactory
|
||||
from src.batch.dcf_inst_merge_io import DcfInstMergeIO
|
||||
from src.batch.mst_inst import MstInst
|
||||
from src.batch.trn_result_data_bio_lot import TrnResultDataBioLot
|
||||
from src.batch.update_business_day import UpdateBusinessDay
|
||||
from src.error.exceptions import BatchOperationException
|
||||
|
||||
|
||||
class TestJskultBatchEntrypointFactory:
|
||||
|
||||
def test_create_trn_result_data_bio_lot(self):
|
||||
# Arrange
|
||||
# Act
|
||||
sut = JskultBatchEntrypointFactory(
|
||||
'jskult-batch-trn-result-data-bio-lot')
|
||||
actual = sut.create()
|
||||
# Assert
|
||||
assert isinstance(actual, TrnResultDataBioLot)
|
||||
|
||||
def test_create_mst_inst_all(self):
|
||||
# Arrange
|
||||
# Act
|
||||
sut = JskultBatchEntrypointFactory(
|
||||
'jskult-batch-mst-inst-all')
|
||||
actual = sut.create()
|
||||
# Assert
|
||||
assert isinstance(actual, MstInst)
|
||||
|
||||
def test_create_dcf_inst_merge_io(self):
|
||||
# Arrange
|
||||
# Act
|
||||
sut = JskultBatchEntrypointFactory(
|
||||
'jskult-batch-dcf-inst-merge-io')
|
||||
actual = sut.create()
|
||||
# Assert
|
||||
assert isinstance(actual, DcfInstMergeIO)
|
||||
|
||||
def test_create_update_business_day(self):
|
||||
# Arrange
|
||||
# Act
|
||||
sut = JskultBatchEntrypointFactory(
|
||||
'jskult-batch-update-business-day')
|
||||
actual = sut.create()
|
||||
# Assert
|
||||
assert isinstance(actual, UpdateBusinessDay)
|
||||
|
||||
def test_create_raise_exception(self):
|
||||
# Arrange
|
||||
# Act
|
||||
sut = JskultBatchEntrypointFactory('unknown')
|
||||
|
||||
with pytest.raises(BatchOperationException):
|
||||
sut.create()
|
||||
Loading…
x
Reference in New Issue
Block a user