feat(카페24): 품목 진열·판매를 모든 멀티쇼핑몰에 같이 반영
- 옵션/품목 팝업 저장 시 기본몰(1)에 반영된 행의 진열·판매만 CAFE24_SHOP_NOS(예 1,2,3)의 다른 쇼핑몰에도 같은 값으로 PUT - 추가금액(통화 다름)·자체코드·순서는 기본몰만 - 다른 쇼핑몰 실패는 응답 shop_failed·감사 기록·화면 경고(기본몰 반영 유지) - 쇼핑몰 목록 API 는 mall.read_store 권한이 필요해 번호를 환경변수로 받음 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -492,6 +492,30 @@ def test_route_09_variants_partial_success():
|
||||
assert resp.status_code == 502
|
||||
|
||||
|
||||
def test_route_09b_display_selling_to_all_shops(monkeypatch):
|
||||
monkeypatch.setenv("CAFE24_SHOP_NOS", "1,2,3")
|
||||
no, cafe = _new_product()
|
||||
created = _create_options(no, ["A", "B"])
|
||||
a, b = (v["variant_code"] for v in created["variants"])
|
||||
cafe.calls.clear()
|
||||
resp = req("PUT", f"/cafe24/products/{no}/variants", json={"rows": [
|
||||
{"variant_code": a, "display": "off", "additional_amount": "500"},
|
||||
{"variant_code": b, "custom_variant_code": "X1"}]})
|
||||
assert resp.status_code == 200, resp.text
|
||||
assert resp.json()["shop_failed"] == {}
|
||||
puts = [c[2] for c in cafe.calls if c[0] == "PUT" and c[1].endswith("/variants")]
|
||||
assert [p["shop_no"] for p in puts] == [1, 2, 3]
|
||||
# 다른 쇼핑몰엔 진열·판매만, 진열/판매를 안 바꾼 행(b)은 안 보낸다
|
||||
assert puts[1]["requests"] == puts[2]["requests"] == [{"variant_code": a, "display": "F"}]
|
||||
# 다른 쇼핑몰 실패는 경고로만(기본몰 반영은 성공)
|
||||
cafe._variant_puts = 0
|
||||
cafe.fail_variant_chunk = 2
|
||||
resp = req("PUT", f"/cafe24/products/{no}/variants", json={"rows": [{"variant_code": a, "selling": "off"}]})
|
||||
cafe.fail_variant_chunk = 0
|
||||
assert resp.status_code == 200 and resp.json()["ok"]
|
||||
assert list(resp.json()["shop_failed"]) == ["2"]
|
||||
|
||||
|
||||
def test_route_10_rename_with_lagging_variants_keeps_rows():
|
||||
no, cafe = _new_product()
|
||||
created = _create_options(no, ["Black", "Red"])
|
||||
|
||||
Reference in New Issue
Block a user