Remove Kingdee sync, business CLI/MCP tools, and internal order-query routing now owned by the separate kingdee-orders-mcp project. Keep Wiki retrieval, file assets and ingest available in code while its deployed service is off. Retain legacy response fields with business access disabled, and document migration ownership and rollback without exposing credentials or data. Validation: 174 Wiki tests pass. Independent order service verified with 36 template parity checks, authenticated HTTP queries, and a real sync.
51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
import importlib.util
|
|
import io
|
|
import sys
|
|
import unittest
|
|
from contextlib import redirect_stdout
|
|
from pathlib import Path
|
|
from unittest.mock import patch
|
|
|
|
|
|
SCRIPT_PATH = Path(__file__).resolve().parent.parent / "scripts" / "obsidian-wiki-ops.py"
|
|
|
|
|
|
def load_user_ops():
|
|
spec = importlib.util.spec_from_file_location("obsidian_wiki_user_ops", SCRIPT_PATH)
|
|
if spec is None or spec.loader is None:
|
|
raise ImportError(f"cannot import {SCRIPT_PATH}")
|
|
module = importlib.util.module_from_spec(spec)
|
|
sys.modules[spec.name] = module
|
|
spec.loader.exec_module(module)
|
|
return module
|
|
|
|
|
|
class UserOpsTests(unittest.TestCase):
|
|
|
|
|
|
def test_mcp_commands_forward_to_mcp_service_manager(self):
|
|
user_ops = load_user_ops()
|
|
|
|
with patch.object(user_ops.manage_mcp_service, "main", return_value=0) as mcp_main:
|
|
status = user_ops.main(["mcp", "start", "--enable-query"])
|
|
|
|
self.assertEqual(status, 0)
|
|
mcp_main.assert_called_once_with(["start", "--enable-query"])
|
|
|
|
def test_help_lists_common_user_operations(self):
|
|
user_ops = load_user_ops()
|
|
output = io.StringIO()
|
|
|
|
with redirect_stdout(output):
|
|
status = user_ops.main(["help"])
|
|
|
|
self.assertEqual(status, 0)
|
|
text = output.getvalue()
|
|
self.assertNotIn("kingdee sync", text)
|
|
self.assertNotIn("timer install", text)
|
|
self.assertIn("mcp start", text)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|