refactor: consolidate finance workflow modules
This commit is contained in:
29
server/tests/test_db_test_helpers.py
Normal file
29
server/tests/test_db_test_helpers.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import UTC, datetime
|
||||
from decimal import Decimal
|
||||
|
||||
from app.models.financial_record import ExpenseClaim
|
||||
from app.test_helpers.db import build_in_memory_session
|
||||
|
||||
|
||||
def test_build_in_memory_session_creates_isolated_sqlite_schema() -> None:
|
||||
with build_in_memory_session() as db:
|
||||
db.add(
|
||||
ExpenseClaim(
|
||||
claim_no="CLM-HELPER-001",
|
||||
employee_name="张三",
|
||||
department_name="研发部",
|
||||
expense_type="travel",
|
||||
reason="测试共享内存数据库夹具",
|
||||
location="上海",
|
||||
amount=Decimal("10.00"),
|
||||
occurred_at=datetime(2026, 6, 23, tzinfo=UTC),
|
||||
status="draft",
|
||||
approval_stage="待提交",
|
||||
risk_flags_json=[],
|
||||
)
|
||||
)
|
||||
db.commit()
|
||||
|
||||
assert db.query(ExpenseClaim).count() == 1
|
||||
Reference in New Issue
Block a user