提交
This commit is contained in:
1 parent
a2125374a8
commit
3950b5c334
157 files changed
+57538
-22359
No files matched your search
@@ -62,10 +62,12 @@ class TestProtocolWithdrawReceipt(unittest.TestCase):
|
||||
finance_confirm_attachments="http://x",
|
||||
update_by=None,
|
||||
update_time=None,
|
||||
tenant_no="zkxw",
|
||||
del_flag=0,
|
||||
)
|
||||
db = MagicMock()
|
||||
orig = psp._get_transfer_or_raise
|
||||
psp._get_transfer_or_raise = lambda *a, **k: t
|
||||
orig = psp._get_transfer_with_schedule_lock
|
||||
psp._get_transfer_with_schedule_lock = lambda *a, **k: t
|
||||
try:
|
||||
out = psp.withdraw_receipt(
|
||||
db, transfer_id="t1", tenant_no="zkxw", user_id="u1"
|
||||
@@ -75,17 +77,23 @@ class TestProtocolWithdrawReceipt(unittest.TestCase):
|
||||
self.assertEqual(out.finance_confirm_attachments, "http://x")
|
||||
db.commit.assert_called()
|
||||
finally:
|
||||
psp._get_transfer_or_raise = orig
|
||||
psp._get_transfer_with_schedule_lock = orig
|
||||
|
||||
def test_withdraw_rejects_non_jfqrz(self):
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import MagicMock
|
||||
from app.crud import protocol_sample_payment as psp
|
||||
|
||||
t = SimpleNamespace(id="t1", pay_status="dfj", finance_remark="x")
|
||||
t = SimpleNamespace(
|
||||
id="t1",
|
||||
pay_status="dfj",
|
||||
finance_remark="x",
|
||||
tenant_no="zkxw",
|
||||
del_flag=0,
|
||||
)
|
||||
db = MagicMock()
|
||||
orig = psp._get_transfer_or_raise
|
||||
psp._get_transfer_or_raise = lambda *a, **k: t
|
||||
orig = psp._get_transfer_with_schedule_lock
|
||||
psp._get_transfer_with_schedule_lock = lambda *a, **k: t
|
||||
try:
|
||||
with self.assertRaises(ValueError) as ctx:
|
||||
psp.withdraw_receipt(
|
||||
@@ -93,7 +101,7 @@ class TestProtocolWithdrawReceipt(unittest.TestCase):
|
||||
)
|
||||
self.assertIn("撤回", str(ctx.exception))
|
||||
finally:
|
||||
psp._get_transfer_or_raise = orig
|
||||
psp._get_transfer_with_schedule_lock = orig
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user