chore: drop legacy export buttons from KS-2/KS-3 pages
UI cleanup after the Word print forms became the only export path: remove КС-2 (Excel) from the KS-2 page and Официальная форма (Word) from the KS-3 page. Keep КС-2 (Word), КС-3 (Word) and the red СТОРНИРОВАН badge on cancelled KS-2. Excel renderer and export endpoints stay as legacy fallbacks; no DB, model or business-logic changes.
This commit is contained in:
@@ -328,25 +328,27 @@ def test_ks3_cross_project_rejected(storage_root, db_session, ctx):
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# UI visibility
|
||||
# UI visibility (DOC-C9: only Word buttons in UI; Excel stays as legacy endpoint)
|
||||
# ---------------------------------------------------------------------------
|
||||
def test_ks2_ui_shows_single_export_button(storage_root, db_session, ctx):
|
||||
client = _client(sessionmaker(bind=db_session.get_bind(), expire_on_commit=False))
|
||||
try:
|
||||
# Draft: single working KS-2 button, no legacy "Официальная форма"
|
||||
# Draft: single working KS-2 (Word) button
|
||||
draft = save_ks2_draft(db_session, ctx["project_id"], "K2-UI", date(2026, 3, 1), None,
|
||||
[(ctx["work_item_id"], Decimal("5"))],
|
||||
reporting_period_from=date(2026, 2, 1),
|
||||
reporting_period_to=date(2026, 2, 28))
|
||||
resp = client.get(f"/projects/{ctx['project_id']}/ks2/{draft.id}")
|
||||
assert "КС-2 (Excel)" in resp.text
|
||||
assert "КС-2 (Word)" in resp.text
|
||||
assert "КС-2 (Excel)" not in resp.text
|
||||
assert "Официальная форма" not in resp.text
|
||||
|
||||
# Issued: same single button
|
||||
ks2 = issue_ks2(db_session, ctx["project_id"], draft.id)
|
||||
resp = client.get(f"/projects/{ctx['project_id']}/ks2/{ks2.id}")
|
||||
assert "КС-2 (Excel)" in resp.text
|
||||
assert "/export/excel" in resp.text
|
||||
assert "КС-2 (Word)" in resp.text
|
||||
assert "КС-2 (Excel)" not in resp.text
|
||||
assert "/export/word" in resp.text
|
||||
assert "Официальная форма" not in resp.text
|
||||
finally:
|
||||
_clear()
|
||||
@@ -358,21 +360,34 @@ def test_ks2_ui_cancelled_shows_storno_badge(storage_root, db_session, ctx):
|
||||
client = _client(sessionmaker(bind=db_session.get_bind(), expire_on_commit=False))
|
||||
try:
|
||||
resp = client.get(f"/projects/{ctx['project_id']}/ks2/{ks2.id}")
|
||||
assert "КС-2 (Excel)" in resp.text
|
||||
assert "КС-2 (Word)" in resp.text
|
||||
assert "КС-2 (Excel)" not in resp.text
|
||||
assert "Официальная форма" not in resp.text
|
||||
assert "СТОРНИРОВАН" in resp.text
|
||||
finally:
|
||||
_clear()
|
||||
|
||||
|
||||
def test_ks3_ui_shows_official_button(storage_root, db_session, ctx):
|
||||
def test_ks3_ui_shows_word_button(storage_root, db_session, ctx):
|
||||
ks2 = _make_issued_ks2(db_session, ctx)
|
||||
ks3 = _make_issued_ks3(db_session, ctx, ks2)
|
||||
client = _client(sessionmaker(bind=db_session.get_bind(), expire_on_commit=False))
|
||||
try:
|
||||
resp = client.get(f"/projects/{ctx['project_id']}/ks3/{ks3.id}")
|
||||
assert "Официальная форма" in resp.text
|
||||
assert "/artifact" in resp.text
|
||||
assert "КС-3 (Word)" in resp.text
|
||||
assert "Официальная форма" not in resp.text
|
||||
finally:
|
||||
_clear()
|
||||
|
||||
|
||||
def test_ks3_ui_no_legacy_artifact_button(storage_root, db_session, ctx):
|
||||
ks2 = _make_issued_ks2(db_session, ctx)
|
||||
ks3 = _make_issued_ks3(db_session, ctx, ks2)
|
||||
client = _client(sessionmaker(bind=db_session.get_bind(), expire_on_commit=False))
|
||||
try:
|
||||
resp = client.get(f"/projects/{ctx['project_id']}/ks3/{ks3.id}")
|
||||
assert "/artifact" not in resp.text
|
||||
assert "Официальная форма (Word)" not in resp.text
|
||||
finally:
|
||||
_clear()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user