Artifex/tests/test_interfaces.py
2026-08-16 15:35:55 +07:00

39 lines
1.2 KiB
Python

from __future__ import annotations
import asyncio
from graph.langgraph_runtime import LangGraphRuntime
from model_router.router import ModelRouter
from tools.capabilities import Capability
def test_model_router_keeps_sol_for_planning_and_qwen_for_work() -> None:
router = ModelRouter()
assert router.route("planning") == "sol"
assert router.route("coding") == "qwen"
assert router.route("review") == "qwen"
def test_model_router_uses_env_model_policy(monkeypatch) -> None:
monkeypatch.setenv("ARTIFEX_PLANNING_MODEL", "terra")
monkeypatch.setenv("ARTIFEX_CODING_MODEL", "qwen")
router = ModelRouter()
assert router.route("planning") == "terra"
assert router.route("coding") == "qwen"
def test_langgraph_runtime_is_hidden_behind_runtime_interface() -> None:
runtime = LangGraphRuntime()
run_id = asyncio.run(runtime.start(project_id="00000000-0000-0000-0000-000000000001"))
assert run_id.startswith("project-")
def test_capability_set_excludes_raw_secret_access() -> None:
values = {capability.value for capability in Capability}
assert "arbitrary_secret_access" not in values
assert "write_worktree" in values