feat: deliver schema 15 monthly settlement lifecycle
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from streamlit.testing.v1 import AppTest
|
||||
|
||||
|
||||
def test_registration_dialog_exposes_real_account_snapshot_link_mode_and_fallback(monkeypatch):
|
||||
from jarca_ledger_mcp.adapters.streamlit import overview_gateway, settlement_gateway
|
||||
|
||||
monkeypatch.setattr(overview_gateway, "get_monthly_settlement_summary", lambda *args, **kwargs: {
|
||||
"success": True, "month": "2026-10", "selected_month": "2026-10", "basis_date": "2026-10-31",
|
||||
"reports": {"cashflow": {}, "budget": {}, "assets": {}},
|
||||
})
|
||||
monkeypatch.setattr(settlement_gateway, "get_monthly_settlement_record", lambda *args, **kwargs: {
|
||||
"success": True, "settlement": {"id": "ms-link-ui", "month": "2026-10", "basis_date": "2026-10-31", "status": "draft"},
|
||||
})
|
||||
monkeypatch.setattr(settlement_gateway, "list_account_snapshots_for_settlement", lambda *args, **kwargs: {
|
||||
"success": True, "closed": False, "status": "draft", "count": 1, "registered_count": 0,
|
||||
"unregistered_count": 1,
|
||||
"snapshots": [{
|
||||
"account_id": "acct-ui", "account_name": "실제 원본계정", "amount": None, "currency": "KRW",
|
||||
"basis_date": None, "display_status": "미등록", "snapshot_id": None,
|
||||
"unlinked_candidates": [
|
||||
{"snapshot_id": "snap-exact", "basis_date": "2026-10-31", "amount": 777, "currency": "KRW", "verification_status": "unverified"},
|
||||
],
|
||||
"previous_ledger": {"id": "prev", "transaction_date": "2026-10-30", "balance_after": 1234, "currency": "KRW"},
|
||||
"next_ledger": {"id": "next", "transaction_date": "2026-11-01", "balance_after": 2345, "currency": "KRW"},
|
||||
}],
|
||||
})
|
||||
|
||||
app = AppTest.from_string(
|
||||
"import streamlit as st\n"
|
||||
"st.query_params.update(page='monthly_settlement', id='ms-link-ui')\n"
|
||||
"from dashboard.page_views.monthly_settlement import page_monthly_settlement\n"
|
||||
"page_monthly_settlement(db_path='synthetic-unused.sqlite3')\n",
|
||||
default_timeout=30,
|
||||
).run()
|
||||
assert not app.exception
|
||||
dialog = [button for button in app.button if button.label == "실제 원본계정"][0].click().run()
|
||||
assert not dialog.exception
|
||||
assert {widget.label: widget for widget in dialog.text_input}["계정"].value == "실제 원본계정"
|
||||
assert dialog.radio[0].value == "기존 스냅샷 연결"
|
||||
assert dialog.selectbox[0].label == "기존 스냅샷"
|
||||
assert "777" in dialog.selectbox[0].options[0]
|
||||
assert {widget.label: widget for widget in dialog.text_input}["선택 금액"].disabled is True
|
||||
|
||||
fallback = dialog.radio[0].set_value("새 평가 등록").run()
|
||||
assert not fallback.exception
|
||||
Reference in New Issue
Block a user