import os

from ims_mcp.config import RosettaConfig


def test_from_env_defaults(monkeypatch):
    monkeypatch.delenv("ROSETTA_SERVER_URL", raising=False)
    monkeypatch.delenv("VERSION", raising=False)
    monkeypatch.delenv("ROSETTA_API_KEY", raising=False)
    cfg = RosettaConfig.from_env()
    assert cfg.server_url == "http://localhost:80"
    assert cfg.instruction_dataset == "aia-r1"


def test_root_filter_parsing(monkeypatch):
    monkeypatch.setenv("INSTRUCTION_ROOT_FILTER", "OrgA, orgB ,")
    cfg = RosettaConfig.from_env()
    assert cfg.root_filter == ["orga", "orgb"]
