b4fbd6fe9f
Deploy Site / deploy-vercel (push) Has been skipped
Deploy Site / deploy-docs (push) Has been skipped
Build Skills Index / build-index (push) Has been skipped
CI / Deny unrelated histories (push) Has been skipped
CI / Detect affected areas (push) Successful in 27m35s
CI / OSV scan (push) Failing after 4s
CI / Build&Test Docker image (push) Successful in 9s
CI / Supply-chain scan (push) Has been skipped
CI / Lint Docker scripts (push) Failing after 5m13s
CI / Check contributors (push) Failing after 12m8s
CI / Docs Site (push) Failing after 12m8s
CI / TypeScript (push) Failing after 12m8s
CI / Python lints (push) Failing after 12m9s
CI / Python tests (push) Failing after 12m9s
CI / Check uv.lock (push) Failing after 23m22s
CI / CI timing report (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
CI / All required checks pass (push) Has been cancelled
63 lines
2.4 KiB
Python
63 lines
2.4 KiB
Python
"""Tests for feishu_doc_tool and feishu_drive_tool — registration and schema validation."""
|
|
|
|
import importlib
|
|
import unittest
|
|
|
|
from tools.registry import registry
|
|
|
|
# Trigger tool discovery so feishu tools get registered
|
|
importlib.import_module("tools.feishu_doc_tool")
|
|
importlib.import_module("tools.feishu_drive_tool")
|
|
|
|
|
|
class TestFeishuToolRegistration(unittest.TestCase):
|
|
"""Verify feishu tools are registered and have valid schemas."""
|
|
|
|
EXPECTED_TOOLS = {
|
|
"feishu_doc_read": "feishu_doc",
|
|
"feishu_drive_list_comments": "feishu_drive",
|
|
"feishu_drive_list_comment_replies": "feishu_drive",
|
|
"feishu_drive_reply_comment": "feishu_drive",
|
|
"feishu_drive_add_comment": "feishu_drive",
|
|
}
|
|
|
|
def test_all_tools_registered(self):
|
|
for tool_name, toolset in self.EXPECTED_TOOLS.items():
|
|
entry = registry.get_entry(tool_name)
|
|
self.assertIsNotNone(entry, f"{tool_name} not registered")
|
|
self.assertEqual(entry.toolset, toolset)
|
|
|
|
def test_schemas_have_required_fields(self):
|
|
for tool_name in self.EXPECTED_TOOLS:
|
|
entry = registry.get_entry(tool_name)
|
|
schema = entry.schema
|
|
self.assertIn("name", schema)
|
|
self.assertEqual(schema["name"], tool_name)
|
|
self.assertIn("description", schema)
|
|
self.assertIn("parameters", schema)
|
|
self.assertIn("type", schema["parameters"])
|
|
self.assertEqual(schema["parameters"]["type"], "object")
|
|
|
|
def test_handlers_are_callable(self):
|
|
for tool_name in self.EXPECTED_TOOLS:
|
|
entry = registry.get_entry(tool_name)
|
|
self.assertTrue(callable(entry.handler))
|
|
|
|
def test_doc_read_schema_params(self):
|
|
entry = registry.get_entry("feishu_doc_read")
|
|
props = entry.schema["parameters"].get("properties", {})
|
|
self.assertIn("doc_token", props)
|
|
|
|
def test_drive_tools_require_file_token(self):
|
|
for tool_name in self.EXPECTED_TOOLS:
|
|
if tool_name == "feishu_doc_read":
|
|
continue
|
|
entry = registry.get_entry(tool_name)
|
|
props = entry.schema["parameters"].get("properties", {})
|
|
self.assertIn("file_token", props, f"{tool_name} missing file_token param")
|
|
self.assertIn("file_type", props, f"{tool_name} missing file_type param")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|