Files
nanobot/tests/test_base_channel.py
Hua d31d6cdbe6
Some checks failed
Test Suite / test (3.11) (push) Failing after 1m32s
Test Suite / test (3.12) (push) Failing after 1m19s
Test Suite / test (3.13) (push) Failing after 1m27s
refactor(channels): formalize default config onboarding
2026-03-17 15:12:15 +08:00

30 lines
793 B
Python

from types import SimpleNamespace
from nanobot.bus.events import OutboundMessage
from nanobot.bus.queue import MessageBus
from nanobot.channels.base import BaseChannel
class _DummyChannel(BaseChannel):
name = "dummy"
async def start(self) -> None:
return None
async def stop(self) -> None:
return None
async def send(self, msg: OutboundMessage) -> None:
return None
def test_is_allowed_requires_exact_match() -> None:
channel = _DummyChannel(SimpleNamespace(allow_from=["allow@email.com"]), MessageBus())
assert channel.is_allowed("allow@email.com") is True
assert channel.is_allowed("attacker|allow@email.com") is False
def test_default_config_returns_none_by_default() -> None:
assert _DummyChannel.default_config() is None