Files
Aislo/resources/tester/test_52_10_structure_spec_road.py
T

66 lines
2.3 KiB
Python

# -*- coding: utf-8 -*-
"""노면공 › 콘크리트 포장 명세 · 기타 이름(사용자 구조물 표 08) — PLAN 52-10.
순수 규칙은 Node 헬퍼(`helper_52_structure_spec.cjs road`)가 돌림 ·
화면은 ORCA `ui_checks/52-10_노면공_기타.js`.
"""
import json
import os
import subprocess
import pytest
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(HERE))
DEFINITION = os.path.join(ROOT, "resources", "master_template", "구조물정의.json")
@pytest.fixture(scope="module")
def out():
proc = subprocess.run(
["node", os.path.join(HERE, "helper_52_structure_spec.cjs"), "road"],
capture_output=True,
text=True,
encoding="utf-8",
timeout=60,
)
assert proc.returncode == 0, proc.stderr
return json.loads(proc.stdout)
def test_명세_등록_필수_컨테이너_하나(out):
assert {"pipe", "pavement_concrete"} <= set(out["registered"]) # 다른 창 명세도 함께 등록됨
assert out["same"] is True
assert out["containers"] == [["detail", "상세 내용", True, "gpavedetail"]]
def test_포장사양_선택지는_명세_한_곳(out):
assert out["choices"] == ["콘크리트"]
def test_저장_키_왕복_옛_칸은_명세_밖(out):
assert out["state"] == {"detail": [{"spec": "콘크리트", "height": "0.2"}]}
assert out["edited"] == {"pave_spec": "콘크리트", "height_m": 0.35}
assert out["cleared"] == {"pave_spec": "콘크리트"}
assert out["keys"] == {"keys": ["pave_spec", "height_m"], "prefixes": []}
assert "length_m" not in out["retired"] # 구간 길이 · 전 · 후는 정의 칸 그대로
assert set(out["retired"]) == {
"thickness_cm",
"width_m",
"widening_area_m2",
"joint_spacing_m",
"separation_sheet",
"wire_mesh",
}
def test_기타_상세_종류_이름_글_칸():
with open(DEFINITION, encoding="utf-8") as f:
doc = json.load(f)
etc = next(t for t in doc["types"] if t["type_id"] == "etc")
name = next(o for o in etc["options"] if o["key"] == "name")
assert name["label"] == "상세 종류 이름" and name["input"] == "text"
pave = next(t for t in doc["types"] if t["type_id"] == "pavement_concrete")
assert [o["key"] for o in pave["options"]][:3] == ["length_m", "before_m", "after_m"]