Skip to content

[Test]: add MCP tool wrapper unit tests - #107

Merged
viiccwen merged 1 commit into
mainfrom
mcp-tool-wrapper-test
Jul 12, 2026
Merged

[Test]: add MCP tool wrapper unit tests#107
viiccwen merged 1 commit into
mainfrom
mcp-tool-wrapper-test

Conversation

@viiccwen

Copy link
Copy Markdown
Contributor

Summary

Add deterministic unit tests for MCP permission checks and tool wrappers. Defer external dependency initialization until MCP server startup so importing the module remains side-effect free for unit tests.

Related Issue

Fixes #84

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Configuration or deployment
  • Tests

Changes

  • Cover allowed-channel, valid-member, non-member, and expired-member permission behavior.
  • Cover check-in generation and member-service wrapper success/error responses with table-driven tests.
  • Cover staff-only member notifications, custom and event delivery, missing events, and upcoming-event listings without live services.
  • Move RAG, course catalog, and member database initialization from module import to the MCP entrypoint.

Testing

  • Local tests or checks pass: make test (145 passed)
  • Manual verification completed: make precommit and git diff --check
  • Not tested; reason:

Impact Checklist

  • Discord bot behavior checked, if affected
  • MCP server behavior checked, if affected
  • Webhook behavior checked, if affected
  • Docker or compose changes checked, if affected
  • Environment variables documented, if changed
  • Logs do not expose secrets or sensitive data

Notes for Reviewers

The tests import MCP tool functions directly and mock member, course, and Discord boundaries. They do not start FastMCP/Uvicorn transports, initialize RAG models, fetch course data, or synchronize member data.

Signed-off-by: viiccwen <vicwen@apache.org>
@viiccwen
viiccwen force-pushed the mcp-tool-wrapper-test branch from ea27df5 to 15f75b5 Compare July 12, 2026 16:01
@viiccwen
viiccwen marked this pull request as ready for review July 12, 2026 16:02
@viiccwen
viiccwen merged commit 46ddb1f into main Jul 12, 2026
2 checks passed
@viiccwen
viiccwen deleted the mcp-tool-wrapper-test branch July 12, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add unit tests for MCP tool wrappers

1 participant