fix: 合同付款预警增加申请人过滤
This commit is contained in:
1 parent
0bcff94001
commit
de5535715b
13 files changed
+96
-39
No files matched your search
@@ -1,9 +1,9 @@
|
||||
"""
|
||||
backend/tests/test_contract_payment_list.py
|
||||
|
||||
用途:验收合同付款台账列表的 keyword 筛选,尤其是按供应商名称模糊匹配。
|
||||
用途:验收合同付款台账列表的 keyword 与申请人筛选。
|
||||
依赖:Flask test client、ContractPaymentContract、Agent 授权。
|
||||
逻辑:构造两份已解析合同,确认供应商片段只命中对应行,且合同号/采购单号检索仍可用。
|
||||
逻辑:构造两份已解析合同,确认供应商/申请人只命中对应行,且合同号/采购单号检索仍可用。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -55,7 +55,7 @@ def _auth_headers(user: User) -> dict[str, str]:
|
||||
|
||||
|
||||
def _seed_parsed_contracts() -> None:
|
||||
"""写入两份已进入台账的合同,供应商名称可区分。"""
|
||||
"""写入两份已进入台账的合同,供应商和申请人都可区分。"""
|
||||
db.session.add_all(
|
||||
[
|
||||
ContractPaymentContract(
|
||||
@@ -63,6 +63,7 @@ def _seed_parsed_contracts() -> None:
|
||||
workflow_no='5203-2609020001',
|
||||
purchase_order_no='5203-2609020001',
|
||||
supplier_name='诺亘(上海)工业自动化有限公司',
|
||||
applicant_name='李采购',
|
||||
parse_status='parsed',
|
||||
status='active',
|
||||
),
|
||||
@@ -71,6 +72,7 @@ def _seed_parsed_contracts() -> None:
|
||||
workflow_no='5203-2608270005',
|
||||
purchase_order_no='5203-2608270005',
|
||||
supplier_name='无锡市质谨机电科技有限公司',
|
||||
applicant_name='王申请',
|
||||
parse_status='parsed',
|
||||
status='active',
|
||||
),
|
||||
@@ -109,3 +111,17 @@ def test_list_contracts_keyword_still_matches_contract_and_po(client, app):
|
||||
assert by_po.get_json()['data']['items'][0]['purchase_order_no'] == '5203-2608270005'
|
||||
assert by_contract.get_json()['data']['total'] == 1
|
||||
assert by_contract.get_json()['data']['items'][0]['contract_no'] == 'HT-20260903-30622-0'
|
||||
|
||||
|
||||
def test_list_contracts_filters_by_applicant(client, app):
|
||||
"""关键词命中申请人姓名时只返回对应合同。"""
|
||||
with app.app_context():
|
||||
user = _create_user(username='cp_list_applicant')
|
||||
_seed_parsed_contracts()
|
||||
|
||||
headers = _auth_headers(user)
|
||||
res = client.get('/api/contract-payment/contracts?keyword=李采', headers=headers)
|
||||
# 关键断言:申请人模糊匹配生效,不误伤其他申请人。
|
||||
assert res.get_json()['data']['total'] == 1
|
||||
assert res.get_json()['data']['items'][0]['applicant_name'] == '李采购'
|
||||
assert res.get_json()['data']['items'][0]['contract_no'] == 'HT-20260903-30622-0'
|
||||
Reference in new issue
Block a user