Skip to content

Add comprehensive unit tests (79 tests, 0% → 97% coverage)#2

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1781199254-add-unit-tests
Open

Add comprehensive unit tests (79 tests, 0% → 97% coverage)#2
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1781199254-add-unit-tests

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

The repo had zero unit tests — only a Docker-dependent smoke-test script (scripts/test_outlook_mcp.py). This PR adds a proper pytest suite covering all source modules in both packages, bringing coverage from 0% to 97%.

What's added:

Package Test file What it covers
gmail-mcp tests/test_mime.py build_raw() — base64url encoding, RFC 2822 headers, threading headers, unicode
gmail-mcp tests/test_gmail.py call() HTTP wrapper — auth header injection, error handling, empty responses
gmail-mcp tests/test_auth.py get_token() — cached valid token, refresh flow, missing credentials error, first-use interactive flow
gmail-mcp tests/test_server.py All 13 Gmail tool functions — search, read, thread, labels, draft (new/update/reply/forward), send (new/draft/reply/reply-all/forward), mark read, flag, move, archive, spam, delete, create mailbox
outlook-mcp tests/test_graph.py call() HTTP wrapper — same coverage as gmail
outlook-mcp tests/test_auth.py get_token() — silent token, device-code flow, failure paths, cache persistence
outlook-mcp tests/test_server.py All 13 Outlook tool functions — same coverage as gmail

All external APIs (httpx, google-auth, msal) are fully mocked — tests run offline in <1s.

Configuration:

  • pytest.ini at repo root with --import-mode=importlib to handle same-named test files across the two packages.

The only uncovered lines (3%) are the main() entrypoints that call server.run() with transport selection.

Link to Devin session: https://app.devin.ai/sessions/32968d7c1f31457baa312260778937f0
Requested by: @fafaisland

… 97% coverage)

- gmail-mcp: tests for mime.py, gmail.py, auth.py, server.py (42 tests)
- outlook-mcp: tests for graph.py, auth.py, server.py (37 tests)
- Add pytest.ini with importlib mode for multi-package test discovery
- All external APIs mocked (httpx, google-auth, msal) — no network needed

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

1 participant