28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
import pytest
|
|
|
|
from v1.agent.tool_registry import validate_tool_spec
|
|
|
|
|
|
class TestValidateToolSpec:
|
|
def test_ui_namespace_must_be_frontend(self):
|
|
with pytest.raises(ValueError, match="ui.* must use frontend target"):
|
|
validate_tool_spec(
|
|
{"name": "ui.navigate_to", "execution_target": "backend"}
|
|
)
|
|
|
|
def test_srv_namespace_must_be_backend(self):
|
|
with pytest.raises(ValueError, match="srv.* must use backend target"):
|
|
validate_tool_spec(
|
|
{"name": "srv.search_docs", "execution_target": "frontend"}
|
|
)
|
|
|
|
def test_ui_namespace_with_frontend_is_valid(self):
|
|
validate_tool_spec({"name": "ui.navigate_to", "execution_target": "frontend"})
|
|
|
|
def test_srv_namespace_with_backend_is_valid(self):
|
|
validate_tool_spec({"name": "srv.search_docs", "execution_target": "backend"})
|
|
|
|
def test_other_namespace_is_valid(self):
|
|
validate_tool_spec({"name": "other.tool", "execution_target": "frontend"})
|
|
validate_tool_spec({"name": "other.tool", "execution_target": "backend"})
|