mcp-adb/tests/test_server.py
Ryan Malloy fb297f7937 Add pytest suite (216 tests) and fix UI/notification parser bugs
Test infrastructure with conftest fixtures mocking run_shell_args/run_adb
for device-free testing across all 8 mixins.

Fixed: UI parser regex couldn't match hyphenated XML attributes
(content-desc, resource-id). Notification parser captured trailing
parenthesis in package names.
2026-02-11 03:38:37 -07:00

37 lines
1.3 KiB
Python

"""Tests for server-level tools (config, help resource)."""
class TestConfigStatus:
async def test_status(self, server):
result = await server.config_status()
assert "developer_mode" in result
assert "auto_select_single_device" in result
assert "current_device" in result
async def test_reflects_current_device(self, server):
server.set_current_device("ABC123")
result = await server.config_status()
assert result["current_device"] == "ABC123"
class TestConfigSetDeveloperMode:
async def test_enable(self, server):
result = await server.config_set_developer_mode(True)
assert result["success"] is True
assert result["developer_mode"] is True
async def test_disable(self, server):
result = await server.config_set_developer_mode(False)
assert result["developer_mode"] is False
class TestConfigSetScreenshotDir:
async def test_set(self, server):
result = await server.config_set_screenshot_dir("/tmp/shots")
assert result["success"] is True
assert result["screenshot_dir"] == "/tmp/shots"
async def test_clear(self, server):
result = await server.config_set_screenshot_dir(None)
assert result["screenshot_dir"] is None