Files
obsidian-wiki/tests/test_user_ops.py
T
Codex 1dd5d8d753 refactor(mcp)!: remove remaining order integration artifacts
Remove order compatibility fields, routing notices and migration references
from Wiki source, skills and documentation. Bump capability schema to v6
and validate the remaining Wiki query response contract.

Move retired runtime configuration, database and completed job archives to
the independent order project, uninstall legacy units and clear stale
bytecode. Keep Git history for provenance.

Validation: 173 Wiki tests pass; live independent order MCP authentication,
queries and write rejection pass after cleanup. No integration filenames,
config keys or source references remain in the Wiki working tree.

BREAKING CHANGE: query results and capability metadata no longer contain
legacy business-related fields. Wiki consumers must use the v6 schema.
2026-10-31 10:25:32 +00:00

49 lines
1.3 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.assertIn("mcp start", text)
if __name__ == "__main__":
unittest.main()