LCORE-1371: MCP OAuth Integration Tests#1218
LCORE-1371: MCP OAuth Integration Tests#1218jrobertboos wants to merge 1 commit intolightspeed-core:mainfrom
Conversation
…points to verify 401 responses with WWW-Authenticate when MCP OAuth is required. Add mock fixtures for Llama Stack client interactions in each test file.
WalkthroughThree integration test files are enhanced with new test fixtures and test cases that validate endpoints properly propagate 401 responses with WWW-Authenticate headers when MCP OAuth is required, extending error-path test coverage without modifying existing endpoint logic. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
♻️ Duplicate comments (1)
tests/integration/endpoints/test_streaming_query_integration.py (1)
76-80:⚠️ Potential issue | 🟠 MajorSame potentially incorrect patch target as in
test_query_integration.py.
"utils.responses.get_mcp_tools"patches the definition site. Ifapp.endpoints.streaming_queryimports the function directly (from utils.responses import get_mcp_tools), the mock won't intercept calls from that module. Verify and, if needed, patch"app.endpoints.streaming_query.get_mcp_tools"instead.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/integration/endpoints/test_streaming_query_integration.py` around lines 76 - 80, The mock currently patches "utils.responses.get_mcp_tools" which may not intercept calls if streaming_query imports get_mcp_tools directly; update the test to patch the symbol used by the code under test by replacing the target with "app.endpoints.streaming_query.get_mcp_tools" (or confirm the import style in app.endpoints.streaming_query and patch that module's get_mcp_tools) so the AsyncMock side_effect oauth_401 is applied where streaming_query calls get_mcp_tools.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@tests/integration/endpoints/test_streaming_query_integration.py`:
- Around line 76-80: The mock currently patches "utils.responses.get_mcp_tools"
which may not intercept calls if streaming_query imports get_mcp_tools directly;
update the test to patch the symbol used by the code under test by replacing the
target with "app.endpoints.streaming_query.get_mcp_tools" (or confirm the import
style in app.endpoints.streaming_query and patch that module's get_mcp_tools) so
the AsyncMock side_effect oauth_401 is applied where streaming_query calls
get_mcp_tools.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
tests/integration/endpoints/test_query_integration.pytests/integration/endpoints/test_streaming_query_integration.pytests/integration/endpoints/test_tools_integration.py
| """Integration tests for the /streaming_query endpoint.""" | ||
|
|
||
| # pylint: disable=too-many-arguments | ||
| # pylint: disable=too-many-positional-arguments |
| """Integration tests for the /tools endpoint.""" | ||
|
|
||
| # pylint: disable=too-many-arguments | ||
| # pylint: disable=too-many-positional-arguments |
Description
Created integration tests for the MCP OAuth flow on the following endpoints:
/tools/query/streaming_queryType of change
Tools used to create PR
Identify any AI code assistants used in this PR (for transparency and review context)
Related Tickets & Documents
Checklist before requesting a review
Testing
Summary by CodeRabbit