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") def test_npc_role_routes_to_npc_model(monkeypatch): monkeypatch.setenv("OLLAMA_NPC_MODEL", "some-npc-model") cfg = for_role("npc") assert cfg.model == "some-npc-model" assert cfg.think is False assert "num_predict" in cfg.options