revert(cafe24): 일괄수정 기능 제거
사용자 결정에 따라 화면·라우트·로직·문서를 모두 제거했다. 제거 대상: routes_bulk.py (파일 삭제) templates/cafe24/bulk.html (파일 삭제) _nav.html 「일괄수정」 탭 router.py import·include·설명 store.py find_style_blocks / replace_first_style_block / 정규식 tests <style> 블록 교체 테스트 6건 docs 2-3 절, 경로 표 3줄, 구조도, Phase 7 표기 DB 는 손대지 않았다. 일괄수정은 전용 스키마를 만들지 않았고, 기존 테이블에 남은 기록은 **실제로 상품에 적용된 변경의 이력**이다. 특히 그때 만들어진 BACKUP revision 은 일괄 적용 이전 내용을 되찾을 유일한 수단이라 지우면 복구가 불가능해진다. 감사로그(action='bulk_style')도 누가 언제 무엇을 바꿨는지 남기는 기록이라 보존한다. 정말 지워야 한다면 별도로 요청받아 진행한다. 부수 수정: 예약 시각 검증 테스트가 실행 시각의 초에 따라 실패할 수 있었다. `datetime-local` 은 초를 버리므로 지금 이 분(分)을 고르면 최대 59초 과거가 되는데, 테스트가 now 의 초를 고정하지 않아 경계에서 흔들렸다. now 를 고정해 결정적으로 만들었다 (3회 반복 실행으로 확인). 검증: 유닛테스트 59개 통과, 라우트 13개, 템플릿 컴파일 확인, 모듈에 bulk 참조 0건. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -539,65 +539,6 @@ def test_format_then_encode_roundtrip():
|
||||
assert saved == raw
|
||||
|
||||
|
||||
# ════════════════════════════════════════════════════════════
|
||||
# <style> 블록 일괄 교체
|
||||
# ════════════════════════════════════════════════════════════
|
||||
_NEW_STYLE = "<style>\n\tdiv {\n\t\ttext-align: center;\n\t}\n</style>"
|
||||
|
||||
|
||||
def test_find_style_blocks():
|
||||
html = "<style>a{}</style><div>x</div><style type=\"text/css\">b{}</style>"
|
||||
blocks = store.find_style_blocks(html)
|
||||
assert len(blocks) == 2
|
||||
assert blocks[0] == "<style>a{}</style>"
|
||||
|
||||
|
||||
def test_replace_first_style_block_only():
|
||||
"""두 번째 이후 <style> 은 건드리지 않는다(남의 CSS 를 조용히 지우지 않게)."""
|
||||
html = "<style>OLD</style><div>x</div><style>KEEP</style>"
|
||||
out = store.replace_first_style_block(html, _NEW_STYLE)
|
||||
assert "OLD" not in out
|
||||
assert "<style>KEEP</style>" in out
|
||||
assert out.startswith(_NEW_STYLE)
|
||||
assert "<div>x</div>" in out
|
||||
|
||||
|
||||
def test_replace_style_inserts_when_missing():
|
||||
out = store.replace_first_style_block("<div>x</div>", _NEW_STYLE)
|
||||
assert out.startswith(_NEW_STYLE)
|
||||
assert "<div>x</div>" in out
|
||||
|
||||
|
||||
def test_replace_style_is_idempotent():
|
||||
once = store.replace_first_style_block("<style>OLD</style><div>x</div>", _NEW_STYLE)
|
||||
assert store.replace_first_style_block(once, _NEW_STYLE) == once
|
||||
|
||||
|
||||
def test_replace_style_survives_formatting():
|
||||
"""정리(포맷)를 거쳐도 <style> 안 탭·줄바꿈이 그대로 남는다."""
|
||||
formatted = store.format_html(
|
||||
store.replace_first_style_block("<style>OLD</style><div>x</div>", _NEW_STYLE)
|
||||
)
|
||||
assert "\tdiv {" in formatted
|
||||
assert "\t\ttext-align: center;" in formatted
|
||||
assert len(store.find_style_blocks(formatted)) == 1
|
||||
|
||||
|
||||
def test_replace_style_keeps_multiline_original_shape():
|
||||
"""원문이 여러 줄이어도 앞 블록만 정확히 잘라낸다."""
|
||||
html = '<style>\n/* 비디오 반응형 */\n.video{max-width:100%}\n</style>\n<img src="a.gif">'
|
||||
out = store.replace_first_style_block(html, _NEW_STYLE)
|
||||
assert "비디오" not in out
|
||||
assert '<img src="a.gif">' in out
|
||||
|
||||
|
||||
def test_fingerprint_detects_change():
|
||||
a = store.fingerprint("<p>A</p>")
|
||||
assert a == store.fingerprint("<p>A</p>")
|
||||
assert a != store.fingerprint("<p>B</p>")
|
||||
assert len(a) == 32
|
||||
|
||||
|
||||
# ════════════════════════════════════════════════════════════
|
||||
# 예약 — 입력 검증
|
||||
# ════════════════════════════════════════════════════════════
|
||||
@@ -628,10 +569,14 @@ def test_parse_schedule_at_rejects_past_and_garbage():
|
||||
|
||||
|
||||
def test_parse_schedule_at_allows_one_minute_grace():
|
||||
"""폼을 채우는 동안 시간이 흐른 경우를 거부하지 않는다."""
|
||||
base = now_kst()
|
||||
just_now = (base - timedelta(seconds=30)).strftime("%Y-%m-%dT%H:%M")
|
||||
assert store.parse_schedule_at(just_now, now=base) is not None
|
||||
"""`datetime-local` 은 초를 버린다 — 지금 이 분(分)을 고른 것을 거부하면 안 된다.
|
||||
|
||||
now 의 초를 고정해 실행 시각에 따라 결과가 달라지지 않게 한다(예전에 이 테스트가
|
||||
초에 따라 실패했다).
|
||||
"""
|
||||
base = now_kst().replace(second=40, microsecond=0)
|
||||
this_minute = base.strftime("%Y-%m-%dT%H:%M") # 초가 잘려 base 보다 40초 과거
|
||||
assert store.parse_schedule_at(this_minute, now=base) is not None
|
||||
|
||||
|
||||
def test_describe_schedule_action():
|
||||
|
||||
Reference in New Issue
Block a user