完成LSFX Mock第二期稳定随机命中后端实施
This commit is contained in:
@@ -185,6 +185,17 @@ def test_build_rule_hit_plan_should_be_deterministic_for_same_log_id():
|
||||
assert 2 <= len(plan1["phase1_hit_rules"]) <= 4
|
||||
|
||||
|
||||
def test_phase2_rule_hit_plan_should_be_deterministic_for_same_log_id():
|
||||
service = FileService(staff_identity_repository=FakeStaffIdentityRepository())
|
||||
|
||||
plan1 = service._build_rule_hit_plan(10001)
|
||||
plan2 = service._build_rule_hit_plan(10001)
|
||||
|
||||
assert plan1 == plan2
|
||||
assert 2 <= len(plan1["phase2_statement_hit_rules"]) <= 4
|
||||
assert 2 <= len(plan1["phase2_baseline_hit_rules"]) <= 4
|
||||
|
||||
|
||||
def test_fetch_inner_flow_should_persist_rule_hit_plan(monkeypatch):
|
||||
service = FileService(staff_identity_repository=FakeStaffIdentityRepository())
|
||||
monkeypatch.setattr(
|
||||
@@ -218,3 +229,46 @@ def test_fetch_inner_flow_should_persist_rule_hit_plan(monkeypatch):
|
||||
"GAMBLING_SENSITIVE_KEYWORD",
|
||||
"FOREX_BUY_AMT",
|
||||
]
|
||||
|
||||
|
||||
def test_fetch_inner_flow_should_persist_phase2_rule_hit_plan(monkeypatch):
|
||||
service = FileService(staff_identity_repository=FakeStaffIdentityRepository())
|
||||
monkeypatch.setattr(
|
||||
service,
|
||||
"_build_rule_hit_plan",
|
||||
lambda log_id: {
|
||||
"large_transaction_hit_rules": ["HOUSE_OR_CAR_EXPENSE", "TAX_EXPENSE"],
|
||||
"phase1_hit_rules": ["GAMBLING_SENSITIVE_KEYWORD", "FOREX_BUY_AMT"],
|
||||
"phase2_statement_hit_rules": [
|
||||
"LOW_INCOME_RELATIVE_LARGE_TRANSACTION",
|
||||
"SALARY_QUICK_TRANSFER",
|
||||
],
|
||||
"phase2_baseline_hit_rules": [
|
||||
"HOUSE_REGISTRATION_MISMATCH",
|
||||
"SUPPLIER_CONCENTRATION",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
response = service.fetch_inner_flow(
|
||||
{
|
||||
"groupId": 1001,
|
||||
"customerNo": "test_customer_001",
|
||||
"dataChannelCode": "test_code",
|
||||
"requestDateId": 20240101,
|
||||
"dataStartDateId": 20240101,
|
||||
"dataEndDateId": 20240131,
|
||||
"uploadUserId": 902001,
|
||||
}
|
||||
)
|
||||
log_id = response["data"][0]
|
||||
record = service.file_records[log_id]
|
||||
|
||||
assert record.phase2_statement_hit_rules == [
|
||||
"LOW_INCOME_RELATIVE_LARGE_TRANSACTION",
|
||||
"SALARY_QUICK_TRANSFER",
|
||||
]
|
||||
assert record.phase2_baseline_hit_rules == [
|
||||
"HOUSE_REGISTRATION_MISMATCH",
|
||||
"SUPPLIER_CONCENTRATION",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user