mirror of
https://github.com/hanzoai/mcp-remote-macos-use.git
synced 2026-10-30 18:28:08 +00:00
- Refactored package structure from mcp_remote_macos_use to mcp_remote_macos - Updated Docker configuration to use uv package manager per Hanzo standards - Fixed CI/CD workflows for multi-platform Docker image publishing - Added compose.yml for easier deployment - Added .env.example for configuration reference - All tests passing (32/32) - Ready for Docker Hub publishing with hanzoai/mcp-remote-macos:latest
51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
import os
|
|
import sys
|
|
import pytest
|
|
from unittest.mock import patch, MagicMock
|
|
|
|
# Add src to path
|
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
# Import after setting path
|
|
import src.mcp_remote_macos
|
|
|
|
class TestInit:
|
|
"""Test suite for package initialization."""
|
|
|
|
@patch('argparse.ArgumentParser')
|
|
def test_argument_parser_creation(self, mock_arg_parser):
|
|
"""Test that the ArgumentParser is created correctly."""
|
|
# Arrange
|
|
mock_parser = MagicMock()
|
|
mock_arg_parser.return_value = mock_parser
|
|
mock_parser.parse_args.return_value = MagicMock()
|
|
|
|
# Act
|
|
with patch('asyncio.run'):
|
|
src.mcp_remote_macos.main()
|
|
|
|
# Assert
|
|
mock_arg_parser.assert_called_once_with(description='VNC MCP Server')
|
|
mock_parser.parse_args.assert_called_once()
|
|
|
|
@patch('asyncio.run')
|
|
def test_server_main_called(self, mock_asyncio_run):
|
|
"""Test that the server's main function is called."""
|
|
# Arrange
|
|
with patch('argparse.ArgumentParser'):
|
|
# Mock the import of server.main
|
|
mock_server_main = MagicMock()
|
|
with patch.dict('sys.modules', {'src.mcp_remote_macos.server': MagicMock(main=mock_server_main)}):
|
|
with patch.object(src.mcp_remote_macos, 'server', MagicMock(main=mock_server_main)):
|
|
# Act
|
|
src.mcp_remote_macos.main()
|
|
|
|
# Assert
|
|
mock_asyncio_run.assert_called_once()
|
|
|
|
def test_package_exports(self):
|
|
"""Test that the package exports the expected items."""
|
|
# Assert
|
|
assert "main" in src.mcp_remote_macos.__all__
|
|
assert hasattr(src.mcp_remote_macos, "main")
|
|
assert callable(src.mcp_remote_macos.main) |