feat: expose win helper via mcp real lab
This commit is contained in:
51
tests/test_mcp_api.py
Normal file
51
tests/test_mcp_api.py
Normal file
@@ -0,0 +1,51 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from isphere_ai_bridge import mcp_api
|
||||
|
||||
|
||||
class MCPApiTests(unittest.TestCase):
|
||||
def test_mcp_api_reads_mock_messages_and_queues_drafts(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
db_path = root / "MsgLib.db"
|
||||
queue_path = root / "drafts.jsonl"
|
||||
audit_path = root / "audit.jsonl"
|
||||
|
||||
created = mcp_api.create_mock_source(str(db_path))
|
||||
self.assertEqual(str(db_path), created["created"])
|
||||
|
||||
messages = mcp_api.read_messages(str(db_path), limit=2)
|
||||
self.assertEqual(2, messages["count"])
|
||||
self.assertEqual("local-db", messages["messages"][0]["source"])
|
||||
|
||||
queued = mcp_api.queue_drafts_for_review(
|
||||
str(db_path),
|
||||
queue_path=str(queue_path),
|
||||
audit_path=str(audit_path),
|
||||
limit=2,
|
||||
)
|
||||
self.assertEqual(2, queued["queued"])
|
||||
self.assertEqual("pending_review", queued["status"])
|
||||
|
||||
audit = mcp_api.read_audit_events(str(audit_path), limit=5)
|
||||
self.assertEqual(2, audit["count"])
|
||||
self.assertIn("content_sha256", audit["events"][0])
|
||||
self.assertNotIn("draft_text", audit["events"][0])
|
||||
|
||||
def test_limit_is_bounded_for_mcp_tools(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
db_path = Path(tmp) / "MsgLib.db"
|
||||
mcp_api.create_mock_source(str(db_path))
|
||||
|
||||
messages = mcp_api.read_messages(str(db_path), limit=1000)
|
||||
|
||||
self.assertEqual(mcp_api.MAX_LIMIT, messages["limit"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user