Files
zkxw/backend/tests/test_sample_info_handle.py
T
zlwuandCursor db31990ebe feat: 细胞存储缴费催缴、统一样本信息与协议支付能力增强
汇总近期业务改动:催缴菜单与后端、样本信息快捷登记与进度、运费关联、客户档案扩展、协议优惠/期次与押金划转,并同步 SQL 迁移与管理端页面收敛。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-10 21:20:37 +08:00

35 lines
1.3 KiB
Python

"""办理 payload 规范化与必填校验。"""
import unittest
from datetime import datetime
from app.services.sample_info_progress import apply_handle_payload
class TestApplyHandlePayload(unittest.TestCase):
def test_apply_sets_status(self):
out = apply_handle_payload(
handle_time=datetime(2026, 10, 5, 9, 0, 0),
handler_user_id="u1",
attachments="http://a.png",
remark="ok",
)
self.assertEqual(out["handle_time"].year, 2026)
self.assertEqual(out["handler_user_id"], "u1")
self.assertEqual(out["make_or_todo_status"], "1")
self.assertEqual(out["legacy_date"], "20261005")
self.assertEqual(out["attachments"], "http://a.png")
self.assertEqual(out["remark"], "ok")
def test_apply_clear(self):
out = apply_handle_payload(
handle_time=None, handler_user_id="u1", attachments="", remark=""
)
self.assertIsNone(out["handle_time"])
self.assertIsNone(out["handler_user_id"])
self.assertEqual(out["make_or_todo_status"], "0")
self.assertEqual(out["legacy_date"], "")
def test_handle_time_requires_handler(self):
with self.assertRaises(ValueError):
apply_handle_payload(handle_time=datetime(2026, 10, 5, 9, 0, 0), handler_user_id="")