test(M01): 조합 시험 사본이 정본 마스터 머리 「폴더」를 안 물려받음 · 정본 폴더 이름에 안 기댐
- test_m01_combo · test_m02_combo_branch · test_m02_combo_layers(master_copy) — 사본 조합 파일에서 「폴더」 뺌(사용자 화면 편집 9f69ebe2 뒤 빨강)
- 마스터 나무 시험은 사본 첫 폴더 이름을 읽어 씀(「실무 일위대가」 박지 않음)
- 정본 마스터 파일은 안 고침
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BU9gbNE3aWFUvE61pS2WGt
This commit is contained in:
@@ -48,6 +48,7 @@ def client(tmp_path: Path, monkeypatch) -> TestClient:
|
||||
own = tmp_path / mcb.FILE # 정본의 견본 조합이 시험 줄 수에 끼지 않게 사본은 비워 시작
|
||||
data = json.loads(own.read_text(encoding="utf-8"))
|
||||
data["줄"] = []
|
||||
data.pop("폴더", None) # 사용자가 화면으로 만든 빈 폴더 목록(정본 머리)도 안 물려받음
|
||||
own.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
monkeypatch.setattr(store, "FOLDER", tmp_path)
|
||||
app = FastAPI()
|
||||
|
||||
@@ -42,6 +42,7 @@ def client(tmp_path, monkeypatch):
|
||||
own = master / combo_store.FILE
|
||||
data = json.loads(own.read_text(encoding="utf-8"))
|
||||
data["줄"] = []
|
||||
data.pop("폴더", None) # 정본 머리의 빈 폴더 목록은 안 물려받음
|
||||
own.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
monkeypatch.setattr(m01, "FOLDER", master)
|
||||
template = tmp_path / "template"
|
||||
|
||||
@@ -200,6 +200,10 @@ def master_copy(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
|
||||
for path in m01.FOLDER.glob("*.json"):
|
||||
if not path.name.startswith("_") or path.name == m01.mk.BOOK.name:
|
||||
shutil.copy(path, folder / path.name)
|
||||
own = folder / combos.FILE # 정본 머리의 빈 폴더 목록(사용자 화면 편집)은 안 물려받음
|
||||
data = json.loads(own.read_text(encoding="utf-8"))
|
||||
data.pop("폴더", None)
|
||||
own.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
monkeypatch.setattr(m01, "FOLDER", folder)
|
||||
return folder
|
||||
|
||||
@@ -211,15 +215,16 @@ def test_마스터_나무는_M01_저장_길_빈_폴더는_머리_틀_검사_통
|
||||
got = _tree(admin, "system", op="rename", 키=first, 이름="이름 바꾼 견본")
|
||||
assert next(r for r in got["줄"] if r["키"] == first)["이름"] == "이름 바꾼 견본"
|
||||
before = _list(admin, "system")
|
||||
assert ["실무 일위대가"] in before["폴더"]
|
||||
old = next(r["구분"] for r in before["줄"] if r["구분"]) # 정본 폴더 이름에 기대지 않음
|
||||
assert [old] in before["폴더"]
|
||||
_tree(admin, "system", op="add-folder", 경로=[], 이름="빈 폴더")
|
||||
got = _tree(admin, "system", op="rename", 경로=["실무 일위대가"], 이름="실무")
|
||||
assert ["실무"] in got["폴더"] and ["빈 폴더"] in got["폴더"]
|
||||
assert ["실무 일위대가"] not in got["폴더"]
|
||||
got = _tree(admin, "system", op="rename", 경로=[old], 이름="시험 폴더")
|
||||
assert ["시험 폴더"] in got["폴더"] and ["빈 폴더"] in got["폴더"]
|
||||
assert [old] not in got["폴더"]
|
||||
doc = json.loads((master_copy / combos.FILE).read_text(encoding="utf-8"))
|
||||
assert ["빈 폴더"] in doc["폴더"]
|
||||
assert sum(r["구분"] == "실무" for r in doc["줄"]) == len(
|
||||
[r for r in before["줄"] if r["구분"] == "실무 일위대가"]
|
||||
assert sum(r["구분"] == "시험 폴더" for r in doc["줄"]) == len(
|
||||
[r for r in before["줄"] if r["구분"] == old]
|
||||
)
|
||||
assert m01.cm.check_form(combos.FILE, doc) == [] # 마스터 틀 그대로
|
||||
_tree(_as(world), "system", 403, op="add-folder", 경로=[], 이름="막힘")
|
||||
|
||||
Reference in New Issue
Block a user