Files
OpenJarvis/tests/channels/test_config.py
T
Jon Saad-FalconandClaude Opus 4.6 8d538cd1b0 Add orchestrator training, channels, LiteLLM engine, and simplify learning taxonomy
Major changes across parallel sessions:

- Add orchestrator SFT & GRPO training subpackage (learning/orchestrator/)
  with episode types, multi-objective reward, prompt registry, policy model,
  RL environment, and registered learning policies
- Add structured THOUGHT/TOOL/INPUT/FINAL_ANSWER mode to OrchestratorAgent
- Add 15 channel backends (Discord, Slack, Telegram, Email, Webhook, IRC,
  Matrix, Teams, WhatsApp, Signal, Mattermost, BlueBubbles, Feishu,
  Google Chat, Webchat) with channel tools and config
- Add LiteLLM engine backend for unified LLM provider access
- Add RLM agent and REPL tool
- Remove ToolLearningPolicy — learning taxonomy now only targets
  Intelligence (LM weights/routing) and Agents (logic/ICL/tool strategies)
- Rename SFTPolicy to SFTRouterPolicy (backward-compat alias kept)
- Remove OpenClaw agent infrastructure (openclaw*.py, openclaw_bridge.py)
- Fix async streaming tests (asyncio.run vs deprecated get_event_loop)
- Fix server channel route tests (pytest.importorskip for optional fastapi)
- Track uv.lock for reproducibility
- Update CLAUDE.md and docs to reflect all changes

1676 tests pass, 37 skipped.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 18:32:32 +00:00

79 lines
2.6 KiB
Python

"""Tests for channel configuration."""
from __future__ import annotations
import textwrap
from pathlib import Path
from openjarvis.core.config import ChannelConfig, JarvisConfig, load_config
class TestChannelConfigDefaults:
def test_channel_config_defaults(self) -> None:
cfg = ChannelConfig()
assert cfg.enabled is False
assert cfg.default_agent == "simple"
def test_channel_config_custom(self) -> None:
cfg = ChannelConfig(
enabled=True,
default_agent="orchestrator",
)
assert cfg.enabled is True
assert cfg.default_agent == "orchestrator"
class TestChannelConfigInJarvisConfig:
def test_channel_config_in_jarvis_config(self) -> None:
cfg = JarvisConfig()
assert hasattr(cfg, "channel")
assert isinstance(cfg.channel, ChannelConfig)
def test_jarvis_config_channel_defaults(self) -> None:
cfg = JarvisConfig()
assert cfg.channel.enabled is False
assert cfg.channel.default_channel == ""
class TestLoadConfigWithChannel:
def test_load_config_with_channel_section(self, tmp_path: Path) -> None:
"""Create a temp TOML with [channel] section and verify values."""
toml_content = textwrap.dedent("""\
[channel]
enabled = true
default_agent = "orchestrator"
""")
config_file = tmp_path / "config.toml"
config_file.write_text(toml_content)
cfg = load_config(path=config_file)
assert cfg.channel.enabled is True
assert cfg.channel.default_agent == "orchestrator"
def test_load_config_without_channel_section(self, tmp_path: Path) -> None:
"""When no [channel] section, defaults should apply."""
toml_content = textwrap.dedent("""\
[engine]
default = "ollama"
""")
config_file = tmp_path / "config.toml"
config_file.write_text(toml_content)
cfg = load_config(path=config_file)
assert cfg.channel.enabled is False
assert cfg.channel.default_channel == ""
def test_load_config_partial_channel_section(self, tmp_path: Path) -> None:
"""Partial [channel] section overlays only specified fields."""
toml_content = textwrap.dedent("""\
[channel]
enabled = true
""")
config_file = tmp_path / "config.toml"
config_file.write_text(toml_content)
cfg = load_config(path=config_file)
assert cfg.channel.enabled is True
# Non-specified fields keep defaults
assert cfg.channel.default_agent == "simple"