新增功能
This commit is contained in:
@@ -4194,6 +4194,7 @@ class SafetyGateTest(TestCase):
|
||||
bot._security_gate_visible = mock.Mock(return_value=False)
|
||||
bot._send_gate_open = mock.Mock(return_value=True)
|
||||
bot.wait_for_mouse_idle = mock.Mock(return_value=True)
|
||||
bot.wait_before_send = mock.Mock(return_value=True)
|
||||
bot._selected_session_fingerprint = mock.Mock(return_value=b"target")
|
||||
bot._chat_identity_signature = mock.Mock(return_value=b"identity")
|
||||
bot._chat_surface_signature = mock.Mock(return_value=b"stable-chat")
|
||||
@@ -4228,6 +4229,62 @@ class SafetyGateTest(TestCase):
|
||||
)
|
||||
)
|
||||
bot._deselect_session.assert_not_called()
|
||||
bot.wait_before_send.assert_called_once_with(b"target")
|
||||
|
||||
def test_review_mode_keeps_verified_draft_and_never_presses_enter(self):
|
||||
bot = WeChatBot.__new__(WeChatBot)
|
||||
fp = b"r" * 40
|
||||
bot.send_mode = "review"
|
||||
bot._pending_reply_sessions = {
|
||||
fp.hex(): {
|
||||
"batch_ready": True,
|
||||
"identity_signature": b"same-title",
|
||||
"generation_surface_signature": b"stable-chat",
|
||||
"last_lines": ["客户甲 10:00:00", "请帮我看看"],
|
||||
}
|
||||
}
|
||||
bot._pending_reply_path = ""
|
||||
bot._persist_pending_replies = mock.Mock(return_value=True)
|
||||
bot._security_gate_visible = mock.Mock(return_value=False)
|
||||
bot._send_gate_open = mock.Mock(return_value=True)
|
||||
bot.wait_before_send = mock.Mock(return_value=True)
|
||||
bot.wait_for_mouse_idle = mock.Mock(return_value=True)
|
||||
bot._raw_selected_session_fingerprint = mock.Mock(return_value=fp)
|
||||
bot._selected_session_fingerprint = mock.Mock(return_value=fp)
|
||||
bot._chat_identity_signature = mock.Mock(return_value=b"same-title")
|
||||
bot._chat_surface_signature = mock.Mock(return_value=b"stable-chat")
|
||||
bot._active_identity_signature = b"same-title"
|
||||
bot._dismiss_owned_blocking_window = mock.Mock(return_value=False)
|
||||
bot._ensure_visible = mock.Mock(return_value=True)
|
||||
bot._dismiss_internal_blocker = mock.Mock(return_value=False)
|
||||
bot._capture_full_window = mock.Mock(return_value=self._nav_surface(True))
|
||||
bot._message_nav_selected = mock.Mock(return_value=True)
|
||||
bot._input_geometry_valid = True
|
||||
bot.input_x = 800
|
||||
bot.input_y = 700
|
||||
bot._begin_bot_mouse = mock.Mock()
|
||||
bot._end_bot_mouse = mock.Mock()
|
||||
bot._read_input_draft = mock.Mock(side_effect=["", "请人工确认"])
|
||||
bot._record_send = mock.Mock()
|
||||
|
||||
with (
|
||||
mock.patch("wechat_bot.pyautogui.hotkey"),
|
||||
mock.patch("wechat_bot.pyautogui.press") as press,
|
||||
mock.patch("wechat_bot.pyperclip.paste", return_value=""),
|
||||
mock.patch("wechat_bot.pyperclip.copy"),
|
||||
mock.patch("wechat_bot.time.sleep"),
|
||||
):
|
||||
self.assertFalse(
|
||||
bot.send_reply("请人工确认", session_id=fp.hex(), expected_fp=fp)
|
||||
)
|
||||
|
||||
state = bot._pending_reply_state(fp)
|
||||
self.assertTrue(state["awaiting_review"])
|
||||
self.assertEqual(state["stage"], "manual_review")
|
||||
self.assertEqual(state["last_pasted_draft"], "请人工确认")
|
||||
self.assertNotIn("send_state", state)
|
||||
self.assertNotIn(mock.call("enter"), press.call_args_list)
|
||||
bot._record_send.assert_not_called()
|
||||
|
||||
def test_final_enter_gate_uses_detected_chat_pane_right(self):
|
||||
"""Regression: an expanded customer panel used to fake a resize forever."""
|
||||
|
||||
Reference in New Issue
Block a user