Problem
Test coverage is minimal. Only utils.py has tests. The two most critical modules — server.py (all tool functions) and client.py (API communication) — have zero test coverage.
Current test coverage
tests/
├── conftest.py # 3 fixtures
└── test_utils.py # 6 tests for utils.py only
Untested modules
| Module |
Lines |
Tests |
Risk |
server.py |
800+ |
0 |
HIGH — all user-facing tools |
client.py |
80 |
0 |
HIGH — API auth, error handling |
const.py |
30 |
0 |
LOW — just constants |
exceptions.py |
20 |
0 |
LOW — just class definitions |
__main__.py |
80 |
0 |
MEDIUM — config generation |
Proposed solution
Priority 1: client.py tests
# tests/test_client.py
def test_client_auth_header():
"""Verify Authorization header is set correctly."""
def test_client_handles_api_error_codes():
"""Verify status_code != 0 raises appropriate exceptions."""
def test_client_handles_auth_error_1004():
"""Verify 1004 raises MinimaxAuthError."""
def test_client_handles_network_error():
"""Verify RequestException is wrapped in MinimaxRequestError."""
Priority 2: server.py tool tests (with mocked API)
# tests/test_tools.py
def test_text_to_audio_validates_empty_text():
"""Verify empty text raises MinimaxRequestError."""
def test_generate_video_validates_empty_prompt():
"""Verify empty prompt raises MinimaxRequestError."""
def test_text_to_image_validates_empty_prompt():
"""Verify empty prompt raises MinimaxRequestError."""
Use unittest.mock.patch to mock api_client calls.
Acceptance criteria
client.py has tests for auth, error handling, and request methods
- Tool functions have tests for input validation and error paths
- Coverage target: >60% for
client.py, >40% for server.py
Problem
Test coverage is minimal. Only
utils.pyhas tests. The two most critical modules —server.py(all tool functions) andclient.py(API communication) — have zero test coverage.Current test coverage
Untested modules
server.pyclient.pyconst.pyexceptions.py__main__.pyProposed solution
Priority 1:
client.pytestsPriority 2:
server.pytool tests (with mocked API)Use
unittest.mock.patchto mockapi_clientcalls.Acceptance criteria
client.pyhas tests for auth, error handling, and request methodsclient.py, >40% forserver.py