git mv gateway/platforms/weixin.py -> plugins/platforms/weixin/adapter.py with plugin.yaml + register(): adapter_factory, check_fn (install_hint = old _BUILTIN_ADAPTERS warning), is_connected, required_env, setup_fn (QR-login wizard moved from hermes_cli/gateway_setup_wizard.py), standalone_sender_fn (native text+media via send_weixin_direct, formerly tools/send_message_senders._send_weixin), allowlist/cron env vars, emoji, allow_update_command. Tests import the plugin path. (cherry picked from commit bdff38c4987cb6f6333b909d4949c68a3bd2a6a2)
26 lines
986 B
Python
26 lines
986 B
Python
"""Text-batch debounce defaults must not exceed Telegram's cadence (#44883, #25056).
|
|
|
|
WhatsApp (5s/10s) and Weixin (3s/5s) used to hold every reply for seconds
|
|
before dispatching; Telegram waits 0.3s (1.0s near a split chunk).
|
|
"""
|
|
|
|
import pytest
|
|
|
|
from gateway.config import PlatformConfig
|
|
from plugins.platforms.weixin.adapter import WeixinAdapter
|
|
from plugins.platforms.whatsapp.adapter import WhatsAppAdapter
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"adapter_cls", [WhatsAppAdapter, WeixinAdapter], ids=["whatsapp", "weixin"],
|
|
)
|
|
def test_text_batch_delays_clamped_to_shared_ceilings(adapter_cls, tmp_path, monkeypatch):
|
|
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
|
|
adapter = adapter_cls(PlatformConfig(
|
|
enabled=True, extra={"text_batch_delay_seconds": "2.5", "text_batch_split_delay_seconds": 7}))
|
|
|
|
assert adapter._text_batch_delay_seconds == adapter._TEXT_BATCH_MAX_DELAY_S
|
|
assert adapter._text_batch_split_delay_seconds == adapter._TEXT_BATCH_MAX_SPLIT_DELAY_S
|