feat(backend): add sample freight CRUD and link/unlink
Provide freight batch create/update/link/unlink, sample enrichment map, and protocol-save draft grouping without writing legacy transport rows. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
66fc507b1a
commit
6d542a0acf
2 files changed
+559
No files matched your search
@@ -1,6 +1,7 @@
|
||||
"""样本运费:运输方式字典解析与关联规则"""
|
||||
|
||||
import unittest
|
||||
from decimal import Decimal
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from app.services.sample_transport_mode import resolve_transport_mode_value
|
||||
@@ -39,5 +40,26 @@ class TestResolveTransportMode(unittest.TestCase):
|
||||
db.add.assert_not_called()
|
||||
|
||||
|
||||
class TestFreightAmountValidation(unittest.TestCase):
|
||||
def test_negative_rejected(self):
|
||||
from app.crud.sample_freight import _parse_amount
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
_parse_amount(-1)
|
||||
|
||||
def test_zero_ok(self):
|
||||
from app.crud.sample_freight import _parse_amount
|
||||
|
||||
self.assertEqual(_parse_amount(0), Decimal("0"))
|
||||
|
||||
def test_empty_rejected(self):
|
||||
from app.crud.sample_freight import _parse_amount
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
_parse_amount(None)
|
||||
with self.assertRaises(ValueError):
|
||||
_parse_amount("")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user