- test_822_2: 직접 값 식 내 기계 = 문서 셈(helper_855_engine.calc · 내 기계 색인) · 점보드릴 주택용 저압 = 문서 셈 재료비 > 114.4 원 판 — helper_855_old_engine_routes 안 읽음 - test_794_1b: 옛 엔진 흐름 줄 막음 시험(master_formula.inputs_of) 지움 — 흐름 길 걷음 · 새 로직 줄 저장 시험 그대로 - test_item_copy_complete: 사본 기준합 = 옛 M01 조합 엔진(master_combo.run) 대조 줄 지움(+ 그 대조용 별도계상 바꿔치기) — 사본 셈 = 층 셈 한 벌 · 마스터 단가 바꿈 → 새로 가져오기 단언 그대로 - test_m02_labor_layer: 자동값 = 문서 자동값(Doc_Copy.auto_of · 옛 master_auto 와 같음) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
2.9 KiB
Python
72 lines
2.9 KiB
Python
"""794-1b — M01 흐름도 걷음 뒤 지킴(마스터 사본 폴더 · 정본 안 바뀜).
|
|
|
|
못박는 것
|
|
- 흐름 길(`/api/m01/logic/flow` · `/api/m02/df/values` …) 없음 · 남긴 바닥 `GET /api/m02/df/standards` 는 그대로
|
|
- [신규 로직] = 흐름 없는 빈 시트 줄 → `/save` 가 자체 파일 GX 새 키 · 구분 자체 · 셈은 옛 셈
|
|
- 줄에 「흐름」 이 남아 있으면 엔진이 까닭 글로 막음(조용히 틀린 값 안 냄)
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import shutil
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from fastapi import FastAPI
|
|
from fastapi.testclient import TestClient
|
|
|
|
from M01_MasterData import M01_MasterData_Router as m01_router
|
|
from M01_MasterData import M01_MasterData_Store as store
|
|
from M02_MasterTemplete.DataFlow import M02_DF_Router as df
|
|
|
|
REAL = store.FOLDER
|
|
OWN = "로직_자체.json"
|
|
|
|
|
|
@pytest.fixture
|
|
def client(tmp_path: Path, monkeypatch) -> TestClient:
|
|
master = tmp_path / "master"
|
|
master.mkdir()
|
|
for path in REAL.glob("*.json"):
|
|
shutil.copy(path, master / path.name)
|
|
shutil.copytree(REAL / "기계", master / "기계") # 기계 = 폴더(826-2)
|
|
monkeypatch.setattr(store, "FOLDER", master)
|
|
shutil.copytree(REAL / "수식문서", master / "수식문서") # 로직 목록 = 수식 문서(855 L2 ⓐ)
|
|
monkeypatch.setattr(store._docs().ml, "FOLDER", master / "수식문서")
|
|
app = FastAPI()
|
|
app.include_router(m01_router.router)
|
|
app.include_router(df.router)
|
|
return TestClient(app)
|
|
|
|
|
|
def test_흐름_길은_없고_표준_표는_남음(client: TestClient) -> None:
|
|
assert client.get("/api/m01/logic/flow", params={"key": "GF000219"}).status_code == 404
|
|
assert client.post("/api/m02/df/values", json={"items": []}).status_code == 404
|
|
got = client.get("/api/m02/df/standards").json()
|
|
assert got["unit"]["줄"] and "money" not in got # 금액 표준 표는 894 에서 걷음(화면 0)
|
|
|
|
|
|
def test_신규_로직은_시트_줄로_자체_GX(client: TestClient) -> None:
|
|
version = next(
|
|
f["version"]
|
|
for f in client.get("/api/m01/groups/로직/files").json()["files"]
|
|
if f["file"] == OWN
|
|
) # 판 = 문서 파일(855 L3 ⓐ)
|
|
row = {
|
|
"키": "",
|
|
"이름": "sub3임시 새 로직",
|
|
"결과단위": "원/㎡",
|
|
"출처": "자체",
|
|
"입력": [],
|
|
"중간": [],
|
|
"호표": [],
|
|
"끝수": None,
|
|
}
|
|
part = {"file": OWN, "version": version, "changes": [{"op": "add", "row": row}]}
|
|
res = client.post("/api/m01/save", json={"files": [part]})
|
|
assert res.status_code == 200, res.text
|
|
added = res.json()["added"]
|
|
assert len(added) == 1 and added[0]["key"].startswith("GX")
|
|
saved = client.get("/api/m01/logic", params={"key": added[0]["key"]}).json()["logic"]
|
|
assert saved["구분"] == "자체" and saved["이름"] == "sub3임시 새 로직" and "흐름" not in saved
|