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_use
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_use.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_use.server': MagicMock(main=mock_server_main)}):
with patch.object(src.mcp_remote_macos_use, 'server', MagicMock(main=mock_server_main)):
# Act
src.mcp_remote_macos_use.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_use.__all__
assert hasattr(src.mcp_remote_macos_use, "main")
assert callable(src.mcp_remote_macos_use.main)