46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
"""协议单缴费明细保存"""
|
|
|
|
import unittest
|
|
from decimal import Decimal
|
|
|
|
from app.crud.collection_protocol import _payment_details_payload_unchanged
|
|
from app.models.models import BizProtocolPaymentDetail
|
|
|
|
|
|
class TestPaymentDetailsPayloadUnchanged(unittest.TestCase):
|
|
def test_unchanged_with_blocking_status(self):
|
|
existing = [
|
|
BizProtocolPaymentDetail(
|
|
installment_no=1,
|
|
pay_status="jfqrz",
|
|
due_amount=Decimal("3000.00"),
|
|
transfer_type="",
|
|
),
|
|
BizProtocolPaymentDetail(
|
|
installment_no=2,
|
|
pay_status="dfj",
|
|
due_amount=Decimal("3000.00"),
|
|
transfer_type="",
|
|
),
|
|
]
|
|
incoming = [
|
|
{"payStatus": "jfqrz", "installmentNo": 1, "dueAmount": 3000},
|
|
{"payStatus": "dfj", "installmentNo": 2, "dueAmount": 3000},
|
|
]
|
|
self.assertTrue(_payment_details_payload_unchanged(existing, incoming))
|
|
|
|
def test_changed_due_amount(self):
|
|
existing = [
|
|
BizProtocolPaymentDetail(
|
|
installment_no=1,
|
|
pay_status="dfj",
|
|
due_amount=Decimal("3000.00"),
|
|
)
|
|
]
|
|
incoming = [{"payStatus": "dfj", "installmentNo": 1, "dueAmount": 3100}]
|
|
self.assertFalse(_payment_details_payload_unchanged(existing, incoming))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|