Files
nanobot/tests/test_hook_channel.py
2026-02-28 23:39:22 +00:00

38 lines
932 B
Python

"""Tests for the hook channel."""
import pytest
from unittest.mock import MagicMock
from nanobot.channels.hook import HookChannel
from nanobot.bus.queue import MessageBus
from nanobot.bus.events import OutboundMessage
@pytest.fixture
def bus():
return MessageBus()
def test_hook_channel_name():
bus = MessageBus()
channel = HookChannel(bus)
assert channel.name == "hook"
@pytest.mark.asyncio
async def test_hook_channel_send_is_noop():
"""send() should not raise and should not do anything."""
bus = MessageBus()
channel = HookChannel(bus)
msg = OutboundMessage(channel="hook", chat_id="test", content="hello")
await channel.send(msg) # Should not raise
@pytest.mark.asyncio
async def test_hook_channel_start_stop():
bus = MessageBus()
channel = HookChannel(bus)
await channel.start()
assert channel.is_running
await channel.stop()
assert not channel.is_running