e63734c984
- 첫 화면 "+ 신규 등록" 옆 엑셀색 버튼 → 작성일·출고일·센터입고일(프로젝트 날짜 팝업), 입고센터(시트 F열 + 등록 센터, 직접 입력), 출고방식(파렛트/택배), 코드표 검색 제품·수량, 출고, 작업자(기본 핫프렌즈) - POST /cupang/api/outbound-sheet: 출고일 시트 YYYYMMDD(요일) 맨 아래에 기존 양식으로 추가 (순번 이어짐·파렛트 배경색), 시트가 없으면 5행 양식째 생성. cupang_db 에는 저장하지 않음 - GET /cupang/api/outbound-sheet/centers: 입고센터 후보(10분 캐시) - export.build_block 분리(기존 build_table 결과 동일), google_sheets 에 sheet_titles·read_ranges·append_block 추가 - 테스트: pytest(양식·입력 검사·덧붙일 위치·Sheets 요청·실제 앱), Playwright 화면 테스트 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.7 KiB
Python
47 lines
1.7 KiB
Python
"""쿠팡 밀크런 첫 화면(달력 + 출고리스트 작성 팝업)을 실제 앱으로 렌더한다. DB·구글 미사용.
|
|
|
|
python tests/js/render_cupang_index.py -> tests/js/.out/cupang_index_render.html
|
|
(브라우저 테스트: tests/js/cupang_outbound.browser.test.js)
|
|
"""
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
from pathlib import Path
|
|
from unittest.mock import patch
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
sys.path.insert(0, str(ROOT))
|
|
for key in ("ASSET", "CAFE24", "CUPANG", "VACATION", "PROJECT", "DISPATCH", "PERFORMANCE",
|
|
"MALAYSIA_STOCK", "ITEMCODE", "EXPENSE", "INOUT"):
|
|
os.environ[key + "_DB_URL"] = ""
|
|
os.environ.update(SESSION_SECRET_KEY="local-render-only", SESSION_COOKIE_SECURE="false",
|
|
PERFORMANCE_AUTO_SYNC="false", CUPANG_SHEET_ID="")
|
|
os.environ["DATA_DIR"] = tempfile.mkdtemp(prefix="cupang-render-")
|
|
|
|
from fastapi.testclient import TestClient # noqa: E402
|
|
|
|
import app.main as main # noqa: E402
|
|
|
|
user = {"email": "staff@test.local", "name": "staff", "role": "user", "is_super_admin": False,
|
|
"modules": {"cupang": True}}
|
|
|
|
|
|
class Store:
|
|
def list_shipments(self, **kw):
|
|
return []
|
|
|
|
def get_shipment(self, **kw):
|
|
return None
|
|
|
|
|
|
main.app.state.cupang_store = Store()
|
|
with patch.object(main, "get_current_user_record", side_effect=lambda r: user), \
|
|
patch.object(main, "get_session_user", side_effect=lambda r: user), \
|
|
patch.object(main.user_store, "get", side_effect=lambda e: user):
|
|
html = TestClient(main.app).get("/cupang/").text
|
|
|
|
out = ROOT / "tests/js/.out/cupang_index_render.html"
|
|
out.parent.mkdir(parents=True, exist_ok=True)
|
|
out.write_text(html, encoding="utf-8")
|
|
print("rendered:", out)
|