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:
@@ -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."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user