- 층 권한 한 벌 M02_Layer_Access — 나무 · 항목(Router_Items) · 양식(Router_Layers) 같은 규칙 · owner 인자 · 남의 층은 읽기만 · 읽기로 남의 층에 뼈대 안 씀
- 남의 층 목록 GET /api/m02/layers/{company|personal}/owners — 시스템 관리자 회사 목록 · 회사 관리자 같은 회사 사람
- ?layer= 페이지 분리 폐기 → 한 화면 뿌리 셋(마스터 · 회사 · 개인) · 뿌리 부품 TreePanel_Roots(펼칠 때 불러옴) · TreePanel 은 owner · api 를 받는 공용 부품
- 진입 해시 ?open=구조물조합|일위대가|옵션|도면&root=&owner= · 항목 고르기 [관리 화면에서 고치기]도 이 해시
- 「항목 나무」 → 「구조물 라이브러리」
- 시험 test_m02_layer_access 새로 · layer_screen · template_layers 새 규칙으로
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
81 lines
2.6 KiB
Python
81 lines
2.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""M02 관리 화면 구조물 라이브러리(PLAN 26-3a) 자료 셈 회귀검증 — 폴더 나무 · 빈 폴더 · 깊이 5 · 찾기 · 폴더 목록.
|
|
|
|
항목 경로 = 폴더 이름 배열 + 마지막 마디가 항목 이름 · 찾는 글이 있으면 맞는 항목과 위 폴더만.
|
|
Node 헬퍼(`helper_m02_treepanel.cjs`)가 TS 를 트랜스파일해 돌리고, 여기서 값을 판정한다.
|
|
"""
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def results():
|
|
proc = subprocess.run(
|
|
["node", os.path.join(HERE, "helper_m02_treepanel.cjs")],
|
|
capture_output=True,
|
|
text=True,
|
|
encoding="utf-8",
|
|
timeout=60,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
return json.loads(proc.stdout)
|
|
|
|
|
|
def test_빈_폴더도_나무에_있음(results):
|
|
tops = [f["path"] for f in results["all"]["folders"]]
|
|
assert ["빈 폴더"] in tops
|
|
dol = next(f for f in results["all"]["folders"] if f["path"] == ["돌기슭막이"])
|
|
assert ["돌기슭막이", "빈 아래"] in [f["path"] for f in dol["folders"]]
|
|
|
|
|
|
def test_맨_위_항목은_폴더_밖(results):
|
|
assert results["all"]["items"] == ["c4"]
|
|
assert results["count"] == 4
|
|
|
|
|
|
def test_깊이_5_항목까지_이어짐(results):
|
|
node = next(f for f in results["all"]["folders"] if f["path"] == ["다섯"])
|
|
for depth in range(2, 5):
|
|
node = node["folders"][0]
|
|
assert len(node["path"]) == depth
|
|
assert node["items"] == ["c3"]
|
|
|
|
|
|
def test_찾기는_맞는_항목과_위_폴더만(results):
|
|
assert results["foundCount"] == 1
|
|
assert [f["path"] for f in results["found"]["folders"]] == [["돌기슭막이"]]
|
|
assert results["found"]["folders"][0]["items"] == ["c2"] # 빈 폴더는 안 보임
|
|
assert results["none"] == {"path": [], "items": [], "folders": []}
|
|
|
|
|
|
def test_키로도_찾음(results):
|
|
assert results["byKey"] == 1
|
|
|
|
|
|
def test_폴더_목록과_위_길(results):
|
|
assert ["다섯", "둘", "셋", "넷"] in results["folders"]
|
|
assert ["빈 폴더"] in results["folders"]
|
|
assert results["ancestors"] == [
|
|
["다섯"],
|
|
["다섯", "둘"],
|
|
["다섯", "둘", "셋"],
|
|
["다섯", "둘", "셋", "넷"],
|
|
]
|
|
assert results["ancestorsTop"] == []
|
|
assert results["ancestorsNone"] == []
|
|
|
|
|
|
def test_안_또는_같음_판정(results):
|
|
assert results["under"] == [True, True, False, False]
|
|
|
|
|
|
def test_잎_이름과_폴더(results):
|
|
assert results["leaf"] == "1.2m"
|
|
assert results["dir"] == ["돌기슭막이", "메쌓기"]
|