- [?] = 좌측 패널 아래 단추 묶음 맨 왼쪽(공용 한 벌 · B02 는 아래 단추 줄 · B08·B09 는 [?] 줄만) - 모달 = 왼쪽 차례 · 오른쪽 글 · 고른 구조물 종류 · 연 상자 항목 먼저 - 글 = resources/help/<B0N>/*.md · 서버가 열 때마다 읽음(파일만 고치면 반영) · 설명서는 뼈대 - 옮김 = B03 안내 셋 · B05 구조물 저장 규칙 · 측구 주인 · 기슭막이 근거 · 칸 기본값 근거 · B06 표준 횡단면 두 줄 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NPJGtfXo6GMbcpiboQC4uK
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
"""54-2 [?] 설명서 — 서버가 resources/help/<페이지>/*.md 를 부를 때마다 읽음(고치면 바로 바뀜)."""
|
|
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from fastapi import HTTPException
|
|
|
|
from common_util.common_util_help_router import HELP_ROOT, read_help
|
|
|
|
|
|
def test_every_page_has_manual_first():
|
|
for n in range(2, 10):
|
|
items = read_help(f"B0{n}")
|
|
assert items and items[0]["key"] == "00_설명서"
|
|
|
|
|
|
def test_title_order_and_live_edit():
|
|
tmp_path = Path(tempfile.mkdtemp())
|
|
page = tmp_path / "B05"
|
|
page.mkdir()
|
|
(page / "10_배관.md").write_text("# 배관\n\n본문", encoding="utf-8")
|
|
(page / "00_설명서.md").write_text("제목 없음", encoding="utf-8")
|
|
items = read_help("B05", tmp_path)
|
|
assert [i["key"] for i in items] == ["00_설명서", "10_배관"]
|
|
assert [i["title"] for i in items] == ["00_설명서", "배관"]
|
|
(page / "10_배관.md").write_text("# 배관\n\n고친 글", encoding="utf-8")
|
|
assert "고친 글" in read_help("B05", tmp_path)[1]["text"]
|
|
|
|
|
|
@pytest.mark.parametrize("page", ["B01", "B10", "../B05", "b05"])
|
|
def test_bad_page_refused(page):
|
|
with pytest.raises(HTTPException):
|
|
read_help(page)
|
|
|
|
|
|
def test_root_is_repo_resources():
|
|
assert HELP_ROOT.parts[-2:] == ("resources", "help")
|