60 lines
2.0 KiB
Python
60 lines
2.0 KiB
Python
from agent.models import FileInfo, CopyField, ProgramMeta, KeyInfo, ModuleInfo, TableColumn, TableInfo
|
|
|
|
|
|
def test_file_info():
|
|
f = FileInfo(
|
|
no=1, file_db_name="OVT-SORTED", identifier="R01",
|
|
dd_name="ZAN04R01", io="I", copy_group="ZAN01REC",
|
|
format="FB", record_len=80, medium="PS", remarks="有效申请"
|
|
)
|
|
assert f.identifier == "R01"
|
|
assert f.medium == "PS"
|
|
|
|
|
|
def test_copy_field():
|
|
cf = CopyField(level=3, name="R01-APPL-ID", raw_name="(A)APPL-ID",
|
|
pic_type="X(008)", pic_bytes=8)
|
|
assert cf.name == "R01-APPL-ID"
|
|
assert cf.pic_bytes == 8
|
|
|
|
|
|
def test_program_meta_defaults():
|
|
meta = ProgramMeta(
|
|
program_id="TEST", program_name="", system_name="",
|
|
pgm_type="", pgm_pattern="",
|
|
summary_lines=[], prerequisites=[],
|
|
files=[], keys=[], modules=[],
|
|
process_detail="", output_records="",
|
|
input_type="file",
|
|
copy_fields={}, db_tables={}
|
|
)
|
|
assert meta.program_id == "TEST"
|
|
assert meta.input_type == "file"
|
|
|
|
|
|
def test_table_info():
|
|
col = TableColumn(no=1, name_jp="社員番号", name_en="EMP_ID",
|
|
type="CHAR", max_len="8", decimal_digits="",
|
|
byte_count="8", nullable=False, is_pk=True)
|
|
table = TableInfo(table_name="EMP_MASTER", db_id="EMP_MASTER",
|
|
copy_id="", columns=[col], pk_columns=["EMP_ID"])
|
|
assert table.pk_columns == ["EMP_ID"]
|
|
assert len(table.columns) == 1
|
|
|
|
|
|
def test_key_info():
|
|
k = KeyInfo(no=1, file_name="ファイルR01",
|
|
sort_condition="A001>A002>A003",
|
|
key_condition="A001>A002>A003")
|
|
assert k.no == 1
|
|
assert k.file_name == "ファイルR01"
|
|
assert "A001" in k.sort_condition
|
|
|
|
|
|
def test_module_info():
|
|
m = ModuleInfo(no=1, function="メッセージ編集出力SUB",
|
|
program_id="SUB02MSG", copy_name="ZANMSGAC")
|
|
assert m.function == "メッセージ編集出力SUB"
|
|
assert m.program_id == "SUB02MSG"
|
|
assert m.copy_name == "ZANMSGAC"
|