From 645092d7adcbb4a8d64604131662fe784eb29ba3 Mon Sep 17 00:00:00 2001 From: YUAN Date: Sun, 6 Sep 2026 15:49:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20FakePublisher=20=E5=AF=B9=E9=BD=90=20pub?= =?UTF-8?q?lisher=20=E5=A5=91=E7=BA=A6(dict=20=E5=85=A5=E5=8F=82,=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E6=96=B9=E5=BA=8F=E5=88=97=E5=8C=96)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_alert_service.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_alert_service.py b/tests/test_alert_service.py index 6af25a0..e653123 100644 --- a/tests/test_alert_service.py +++ b/tests/test_alert_service.py @@ -24,11 +24,14 @@ from app.service.risk.rules import RULE_ALERT_TYPES, RuleHit class FakePublisher: + """对齐 AlertPublisher 契约:publish(channel, payload_dict),序列化由实现方负责。""" + def __init__(self): self.messages = [] def publish(self, channel, payload): - self.messages.append((channel, json.loads(payload))) + assert isinstance(payload, dict) + self.messages.append((channel, payload)) @pytest.fixture()