test: add channel filter and JSON log tests

TestChannelFilter: allowed/denied/PM/no-config/core-exempt/ampersand.
TestChannelConfig: TOML loading, defaults. TestJsonFormatter: fields,
exception, unicode, single-line, timestamp format.
This commit is contained in:
user
2026-02-15 04:16:49 +01:00
parent b32c9efb8a
commit 668d7f89b8
3 changed files with 148 additions and 0 deletions

View File

@@ -70,6 +70,25 @@ class TestLoad:
assert result["bot"]["channels"] == ["#test"]
class TestChannelConfig:
"""Test channel-level configuration merging."""
def test_channel_config_loaded(self, tmp_path: Path):
config_file = tmp_path / "test.toml"
config_file.write_text(
'[channels."#ops"]\nplugins = ["core", "dns"]\n'
)
result = load(config_file)
assert "#ops" in result["channels"]
assert result["channels"]["#ops"]["plugins"] == ["core", "dns"]
def test_default_channels_empty(self):
assert DEFAULTS["channels"] == {}
def test_default_logging_format(self):
assert DEFAULTS["logging"]["format"] == "text"
class TestResolveConfig:
"""Test config path resolution and fallback."""