Copilot commented on code in PR #40359: URL: https://github.com/apache/superset/pull/40359#discussion_r3285743329
########## tests/unit_tests/mcp_service/report/tool/test_create_report.py: ########## @@ -0,0 +1,258 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from unittest.mock import MagicMock, patch + +import pytest +from fastmcp import Client + +from superset.mcp_service.app import mcp +from superset.mcp_service.report.schemas import CreateReportRequest, RecipientConfig +from superset.utils import json + + [email protected] +def mcp_server(): + return mcp + + +def _make_mock_schedule( + id: int = 1, + name: str = "Weekly Report", + schedule_type: str = "Report", + crontab: str = "0 9 * * 1", + active: bool = True, +) -> MagicMock: + schedule = MagicMock() + schedule.id = id + schedule.name = name + schedule.type = schedule_type + schedule.crontab = crontab + schedule.active = active + return schedule Review Comment: These client-based MCP tool tests are missing the standard auth mocking fixture (patching `superset.mcp_service.auth.get_user_from_request`). Since `@tool` defaults `protect=True`, unauthenticated `Client.call_tool()` invocations will fail before reaching the patched command. Add an `@pytest.fixture(autouse=True)` similar to other `tests/unit_tests/mcp_service/**/tool` modules to provide a mock user (and, if needed, ownership checks). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
