feat(vacation): 설정 화면·공휴일 설정 삭제 · 옵션 수정 = 관리자·승인자·통보자
- [설정] 버튼·설정 화면·공휴일 추가/삭제 삭제(예전 /vacation/settings 는 옵션으로), 쓰지 않는 CSS·db 공휴일 CRUD 정리 - 쉬는 날 = 국경일·대체공휴일 표(KR_HOLIDAYS)만 — vacation_holidays 는 남아 있지만 읽지 않음 - 옵션(승인자·통보자·잔여 연차) 수정 = ERP 관리자(수퍼 포함) + 지금 승인자 + 승인 통보자(_can_edit_options), 예전엔 관리자만 - 테스트: 실제 PG(국경일 표만), 실제 앱(통보자·승인자 수정 가능·그 밖 403, 설정 주소 없음·버튼 없음) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -239,7 +239,7 @@ def body(c):
|
||||
who["u"] = kim
|
||||
r = c.get("/vacation/options")
|
||||
assert r.status_code == 200, r.status_code
|
||||
assert "휴가 승인자" in r.text and "휴가 승인 통보자" in r.text and "ERP 관리자만 바꿀 수 있습니다" in r.text
|
||||
assert "휴가 승인자" in r.text and "휴가 승인 통보자" in r.text and "ERP 관리자·휴가 승인자·승인 통보자만 바꿀 수 있습니다" in r.text
|
||||
assert 'value="lee@test.local" disabled' in r.text and ">저장</button>" not in r.text
|
||||
assert "Gmail 연결을 쓸 수 없는 서버" in r.text # 입출고 DB 없음 → 회사 메일 안내
|
||||
assert c.post("/vacation/options", data={"approvers": ["lee@test.local"]}).status_code == 403
|
||||
@@ -254,6 +254,17 @@ def body(c):
|
||||
assert r.status_code == 303 and r.headers["location"].startswith("/vacation/options?msg="), r.status_code
|
||||
assert st.opts["approvers"] == ["lee@test.local"] and st.opts["notifiers"] == ["kim@test.local"]
|
||||
assert 'value="lee@test.local" checked' in c.get("/vacation/options").text
|
||||
# 옵션 수정 = 관리자 + 승인자 + 통보자(2026-10-27) — 통보자 kim·승인자 lee 는 저장 가능, 칩만 있는 chip 은 이제 승인자가 아니라 403
|
||||
who["u"] = kim
|
||||
r = c.get("/vacation/options")
|
||||
assert 'value="lee@test.local" checked' in r.text and 'value="chip@test.local" disabled' not in r.text and ">저장</button>" in r.text
|
||||
assert c.post("/vacation/options", data={"approvers": ["lee@test.local"], "notifiers": ["kim@test.local"]}).status_code == 303
|
||||
who["u"] = lee
|
||||
assert c.post("/vacation/options", data={"approvers": ["lee@test.local"], "notifiers": ["kim@test.local"]}).status_code == 303
|
||||
who["u"] = chip
|
||||
assert c.post("/vacation/options", data={"approvers": ["chip@test.local"]}).status_code == 403
|
||||
assert st.opts["approvers"] == ["lee@test.local"] and st.opts["notifiers"] == ["kim@test.local"]
|
||||
who["u"] = admin
|
||||
# 승인자를 지정하면 그 사람만(+관리자) — 칩만 있는 chip 은 이제 403
|
||||
st.req["status"] = "제출"
|
||||
who["u"] = chip
|
||||
@@ -384,20 +395,28 @@ def body(c):
|
||||
assert saved == {"year": 2026, "rows": [{"user_email": "lee@test.local", "total_days": 16.0, "memo": "a"},
|
||||
{"user_email": "chip@test.local", "total_days": 15.5, "memo": "c"}]}, saved
|
||||
assert c.post("/vacation/options/balances", data={"year": "2026", "email": ["lee@test.local"], "total": ["x"], "memo": [""]}).status_code == 400
|
||||
# 관리자 아님 — 표 안 보임, 저장 403
|
||||
# 승인자(옵션 미지정 → 휴가 승인 권한 chip)는 잔여 연차도 보고 저장
|
||||
who["u"] = chip
|
||||
assert 'id="balances"' in c.get("/vacation/options").text
|
||||
assert c.post("/vacation/options/balances", data={"year": "2026", "email": ["kim@test.local"], "total": ["14"], "memo": [""]}).status_code == 303
|
||||
# 관리자·승인자·통보자 아님 — 표 안 보임, 저장 403
|
||||
who["u"] = kim
|
||||
assert 'id="balances"' not in c.get("/vacation/options").text
|
||||
assert c.post("/vacation/options/balances", data={"year": "2026", "email": ["kim@test.local"], "total": ["30"], "memo": [""]}).status_code == 403
|
||||
# 설정 — 잔여 연차 입력 없음(옵션 안내)
|
||||
# 설정 화면 삭제 — 예전 주소는 옵션으로, 공휴일·잔여 연차 저장 주소 없음
|
||||
who["u"] = admin
|
||||
t = c.get("/vacation/settings?year=2026").text
|
||||
assert "/vacation/settings/balances" not in t and "/vacation/options?year=2026#balances" in t
|
||||
assert c.post("/vacation/settings/balances", data={"user_email": "a@test.local", "year": "2026", "total_days": "1"}).status_code in (404, 405)
|
||||
r = c.get("/vacation/settings?year=2026")
|
||||
assert r.status_code == 303 and r.headers["location"] == "/vacation/options", r.status_code
|
||||
for url, data in (("/vacation/settings/holidays", {"holiday_date": "2026-10-08", "name": "x"}),
|
||||
("/vacation/settings/holidays/1/delete", {}),
|
||||
("/vacation/settings/balances", {"user_email": "a@test.local", "year": "2026", "total_days": "1"})):
|
||||
assert c.post(url, data=data).status_code in (404, 405), url
|
||||
# 달력 — 국경일·대체공휴일 이름이 날짜 아래, 그 주는 has-hol, 잔여 옆 12/31 소멸
|
||||
t = c.get("/vacation/?year=2026&month=10").text
|
||||
assert '<span class="vac-hol-name">개천절</span>' in t and '<span class="vac-hol-name">개천절 대체</span>' in t
|
||||
assert '<span class="vac-hol-name">한글날</span>' in t and t.count("has-hol") == 2, t.count("has-hol")
|
||||
assert "2026.12.31 소멸" in t
|
||||
assert 'href="/vacation/settings' not in t and ">설정</a>" not in t and 'href="/vacation/options"' in t # 설정 버튼 없음
|
||||
print("OK")
|
||||
run(body)
|
||||
''')
|
||||
|
||||
Reference in New Issue
Block a user