import pytest

from app.routing import for_role


def test_narrator_defaults():
    cfg = for_role("narrator")
    assert cfg.model == "qwen3.5:latest"
    assert cfg.think is False
    assert cfg.options["num_predict"] == 300
    assert cfg.options["temperature"] == 0.8


def test_env_overrides_model(monkeypatch):
    monkeypatch.setenv("OLLAMA_NARRATOR_MODEL", "llama3.1:latest")
    assert for_role("narrator").model == "llama3.1:latest"


def test_unknown_role_raises():
    with pytest.raises(KeyError):
        for_role("wizard")
