MiniMax-AI / MiniMax-AI/MiniMax-MCP

test: expand test coverage — only utils tested, server and client have zero tests

Open
#72 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.6k
Forks
284
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/conftest.py and tests/test_utils.py to understand the existing fixtures and style, then inspect client.py and server.py. Add tests/test_client.py for authentication, API and network errors, and tests/test_tools.py for empty-input validation using unittest.mock.patch for api_client calls. Done means the stated client.py and server.py coverage targets and acceptance criteria are met.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.