22 lines
675 B
Python
22 lines
675 B
Python
"""持久化任务需要完整的幂等和重试证据,不能只有运行中的内存对象。"""
|
|
|
|
from app.models import TPlusSyncBatch
|
|
|
|
|
|
def test_批次记录范围重试幂等与报告():
|
|
table = TPlusSyncBatch.__table__
|
|
assert {
|
|
"entity_types_json",
|
|
"skipped_record_count",
|
|
"parent_batch_no",
|
|
"request_key",
|
|
"requested_by",
|
|
"audit_result_json",
|
|
} <= set(table.c.keys())
|
|
assert table.c.started_at.nullable is True
|
|
|
|
|
|
def test_请求键由数据库唯一约束保护():
|
|
constraints = TPlusSyncBatch.__table__.constraints
|
|
assert any(c.name == "uk_tplus_sync_batches_request_key" for c in constraints)
|