Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
bf00022
1
Parent(s): 7e4a5c7
Remove asyncio mark
Browse files
tests/contrib/test_component_manager.py
CHANGED
|
@@ -566,7 +566,6 @@ class TestComponentManagerWithPath:
|
|
| 566 |
def client_with_path(self, mcp_with_path):
|
| 567 |
return TestClient(mcp_with_path.http_app())
|
| 568 |
|
| 569 |
-
@pytest.mark.asyncio
|
| 570 |
async def test_enable_tool_route_with_path(self, client_with_path, mcp_with_path):
|
| 571 |
tool = await mcp_with_path._tool_manager.get_tool("test_tool")
|
| 572 |
tool.enabled = False
|
|
@@ -576,7 +575,6 @@ class TestComponentManagerWithPath:
|
|
| 576 |
tool = await mcp_with_path._tool_manager.get_tool("test_tool")
|
| 577 |
assert tool.enabled is True
|
| 578 |
|
| 579 |
-
@pytest.mark.asyncio
|
| 580 |
async def test_disable_resource_route_with_path(
|
| 581 |
self, client_with_path, mcp_with_path
|
| 582 |
):
|
|
@@ -592,7 +590,6 @@ class TestComponentManagerWithPath:
|
|
| 592 |
)
|
| 593 |
assert resource.enabled is False
|
| 594 |
|
| 595 |
-
@pytest.mark.asyncio
|
| 596 |
async def test_enable_prompt_route_with_path(self, client_with_path, mcp_with_path):
|
| 597 |
prompt = await mcp_with_path._prompt_manager.get_prompt("test_prompt")
|
| 598 |
prompt.enabled = False
|
|
@@ -646,7 +643,6 @@ class TestComponentManagerWithPathAuth:
|
|
| 646 |
|
| 647 |
self.client = TestClient(self.mcp.http_app())
|
| 648 |
|
| 649 |
-
@pytest.mark.asyncio
|
| 650 |
async def test_unauthorized_enable_tool(self):
|
| 651 |
tool = await self.mcp._tool_manager.get_tool("test_tool")
|
| 652 |
tool.enabled = False
|
|
@@ -654,7 +650,6 @@ class TestComponentManagerWithPathAuth:
|
|
| 654 |
assert response.status_code == 401
|
| 655 |
assert tool.enabled is False
|
| 656 |
|
| 657 |
-
@pytest.mark.asyncio
|
| 658 |
async def test_forbidden_enable_tool(self):
|
| 659 |
tool = await self.mcp._tool_manager.get_tool("test_tool")
|
| 660 |
tool.enabled = False
|
|
@@ -665,7 +660,6 @@ class TestComponentManagerWithPathAuth:
|
|
| 665 |
assert response.status_code == 403
|
| 666 |
assert tool.enabled is False
|
| 667 |
|
| 668 |
-
@pytest.mark.asyncio
|
| 669 |
async def test_authorized_enable_tool(self):
|
| 670 |
tool = await self.mcp._tool_manager.get_tool("test_tool")
|
| 671 |
tool.enabled = False
|
|
@@ -678,7 +672,6 @@ class TestComponentManagerWithPathAuth:
|
|
| 678 |
tool = await self.mcp._tool_manager.get_tool("test_tool")
|
| 679 |
assert tool.enabled is True
|
| 680 |
|
| 681 |
-
@pytest.mark.asyncio
|
| 682 |
async def test_unauthorized_disable_resource(self):
|
| 683 |
resource = await self.mcp._resource_manager.get_resource("data://test_resource")
|
| 684 |
resource.enabled = True
|
|
@@ -686,7 +679,6 @@ class TestComponentManagerWithPathAuth:
|
|
| 686 |
assert response.status_code == 401
|
| 687 |
assert resource.enabled is True
|
| 688 |
|
| 689 |
-
@pytest.mark.asyncio
|
| 690 |
async def test_forbidden_disable_resource(self):
|
| 691 |
resource = await self.mcp._resource_manager.get_resource("data://test_resource")
|
| 692 |
resource.enabled = True
|
|
@@ -697,7 +689,6 @@ class TestComponentManagerWithPathAuth:
|
|
| 697 |
assert response.status_code == 403
|
| 698 |
assert resource.enabled is True
|
| 699 |
|
| 700 |
-
@pytest.mark.asyncio
|
| 701 |
async def test_authorized_disable_resource(self):
|
| 702 |
resource = await self.mcp._resource_manager.get_resource("data://test_resource")
|
| 703 |
resource.enabled = True
|
|
@@ -710,7 +701,6 @@ class TestComponentManagerWithPathAuth:
|
|
| 710 |
resource = await self.mcp._resource_manager.get_resource("data://test_resource")
|
| 711 |
assert resource.enabled is False
|
| 712 |
|
| 713 |
-
@pytest.mark.asyncio
|
| 714 |
async def test_unauthorized_enable_prompt(self):
|
| 715 |
prompt = await self.mcp._prompt_manager.get_prompt("test_prompt")
|
| 716 |
prompt.enabled = False
|
|
@@ -718,7 +708,6 @@ class TestComponentManagerWithPathAuth:
|
|
| 718 |
assert response.status_code == 401
|
| 719 |
assert prompt.enabled is False
|
| 720 |
|
| 721 |
-
@pytest.mark.asyncio
|
| 722 |
async def test_forbidden_enable_prompt(self):
|
| 723 |
prompt = await self.mcp._prompt_manager.get_prompt("test_prompt")
|
| 724 |
prompt.enabled = False
|
|
@@ -729,7 +718,6 @@ class TestComponentManagerWithPathAuth:
|
|
| 729 |
assert response.status_code == 403
|
| 730 |
assert prompt.enabled is False
|
| 731 |
|
| 732 |
-
@pytest.mark.asyncio
|
| 733 |
async def test_authorized_enable_prompt(self):
|
| 734 |
prompt = await self.mcp._prompt_manager.get_prompt("test_prompt")
|
| 735 |
prompt.enabled = False
|
|
|
|
| 566 |
def client_with_path(self, mcp_with_path):
|
| 567 |
return TestClient(mcp_with_path.http_app())
|
| 568 |
|
|
|
|
| 569 |
async def test_enable_tool_route_with_path(self, client_with_path, mcp_with_path):
|
| 570 |
tool = await mcp_with_path._tool_manager.get_tool("test_tool")
|
| 571 |
tool.enabled = False
|
|
|
|
| 575 |
tool = await mcp_with_path._tool_manager.get_tool("test_tool")
|
| 576 |
assert tool.enabled is True
|
| 577 |
|
|
|
|
| 578 |
async def test_disable_resource_route_with_path(
|
| 579 |
self, client_with_path, mcp_with_path
|
| 580 |
):
|
|
|
|
| 590 |
)
|
| 591 |
assert resource.enabled is False
|
| 592 |
|
|
|
|
| 593 |
async def test_enable_prompt_route_with_path(self, client_with_path, mcp_with_path):
|
| 594 |
prompt = await mcp_with_path._prompt_manager.get_prompt("test_prompt")
|
| 595 |
prompt.enabled = False
|
|
|
|
| 643 |
|
| 644 |
self.client = TestClient(self.mcp.http_app())
|
| 645 |
|
|
|
|
| 646 |
async def test_unauthorized_enable_tool(self):
|
| 647 |
tool = await self.mcp._tool_manager.get_tool("test_tool")
|
| 648 |
tool.enabled = False
|
|
|
|
| 650 |
assert response.status_code == 401
|
| 651 |
assert tool.enabled is False
|
| 652 |
|
|
|
|
| 653 |
async def test_forbidden_enable_tool(self):
|
| 654 |
tool = await self.mcp._tool_manager.get_tool("test_tool")
|
| 655 |
tool.enabled = False
|
|
|
|
| 660 |
assert response.status_code == 403
|
| 661 |
assert tool.enabled is False
|
| 662 |
|
|
|
|
| 663 |
async def test_authorized_enable_tool(self):
|
| 664 |
tool = await self.mcp._tool_manager.get_tool("test_tool")
|
| 665 |
tool.enabled = False
|
|
|
|
| 672 |
tool = await self.mcp._tool_manager.get_tool("test_tool")
|
| 673 |
assert tool.enabled is True
|
| 674 |
|
|
|
|
| 675 |
async def test_unauthorized_disable_resource(self):
|
| 676 |
resource = await self.mcp._resource_manager.get_resource("data://test_resource")
|
| 677 |
resource.enabled = True
|
|
|
|
| 679 |
assert response.status_code == 401
|
| 680 |
assert resource.enabled is True
|
| 681 |
|
|
|
|
| 682 |
async def test_forbidden_disable_resource(self):
|
| 683 |
resource = await self.mcp._resource_manager.get_resource("data://test_resource")
|
| 684 |
resource.enabled = True
|
|
|
|
| 689 |
assert response.status_code == 403
|
| 690 |
assert resource.enabled is True
|
| 691 |
|
|
|
|
| 692 |
async def test_authorized_disable_resource(self):
|
| 693 |
resource = await self.mcp._resource_manager.get_resource("data://test_resource")
|
| 694 |
resource.enabled = True
|
|
|
|
| 701 |
resource = await self.mcp._resource_manager.get_resource("data://test_resource")
|
| 702 |
assert resource.enabled is False
|
| 703 |
|
|
|
|
| 704 |
async def test_unauthorized_enable_prompt(self):
|
| 705 |
prompt = await self.mcp._prompt_manager.get_prompt("test_prompt")
|
| 706 |
prompt.enabled = False
|
|
|
|
| 708 |
assert response.status_code == 401
|
| 709 |
assert prompt.enabled is False
|
| 710 |
|
|
|
|
| 711 |
async def test_forbidden_enable_prompt(self):
|
| 712 |
prompt = await self.mcp._prompt_manager.get_prompt("test_prompt")
|
| 713 |
prompt.enabled = False
|
|
|
|
| 718 |
assert response.status_code == 403
|
| 719 |
assert prompt.enabled is False
|
| 720 |
|
|
|
|
| 721 |
async def test_authorized_enable_prompt(self):
|
| 722 |
prompt = await self.mcp._prompt_manager.get_prompt("test_prompt")
|
| 723 |
prompt.enabled = False
|
tests/server/openapi/test_explode_integration.py
CHANGED
|
@@ -7,7 +7,6 @@ specifications and properly applied during HTTP request serialization.
|
|
| 7 |
from unittest.mock import AsyncMock, MagicMock
|
| 8 |
|
| 9 |
import httpx
|
| 10 |
-
import pytest
|
| 11 |
|
| 12 |
from fastmcp.server.openapi import OpenAPITool
|
| 13 |
from fastmcp.utilities.openapi import parse_openapi_to_http_routes
|
|
@@ -130,7 +129,6 @@ class TestExplodeIntegration:
|
|
| 130 |
f"Expected explode=None, got {parameter.explode}"
|
| 131 |
)
|
| 132 |
|
| 133 |
-
@pytest.mark.asyncio
|
| 134 |
async def test_explode_false_request_serialization(self):
|
| 135 |
"""Test that explode=false results in comma-separated query parameters in HTTP requests.
|
| 136 |
|
|
@@ -201,7 +199,6 @@ class TestExplodeIntegration:
|
|
| 201 |
f"Expected 'red,blue,green', got '{tags_value}'"
|
| 202 |
)
|
| 203 |
|
| 204 |
-
@pytest.mark.asyncio
|
| 205 |
async def test_explode_true_request_serialization(self):
|
| 206 |
"""Test that explode=true results in separate query parameters in HTTP requests."""
|
| 207 |
openapi_spec = {
|
|
@@ -262,7 +259,6 @@ class TestExplodeIntegration:
|
|
| 262 |
f"Expected ['red', 'blue', 'green'], got {tags_value}"
|
| 263 |
)
|
| 264 |
|
| 265 |
-
@pytest.mark.asyncio
|
| 266 |
async def test_explode_default_request_serialization(self):
|
| 267 |
"""Test that default behavior (no explode) uses explode=true for query parameters."""
|
| 268 |
openapi_spec = {
|
|
|
|
| 7 |
from unittest.mock import AsyncMock, MagicMock
|
| 8 |
|
| 9 |
import httpx
|
|
|
|
| 10 |
|
| 11 |
from fastmcp.server.openapi import OpenAPITool
|
| 12 |
from fastmcp.utilities.openapi import parse_openapi_to_http_routes
|
|
|
|
| 129 |
f"Expected explode=None, got {parameter.explode}"
|
| 130 |
)
|
| 131 |
|
|
|
|
| 132 |
async def test_explode_false_request_serialization(self):
|
| 133 |
"""Test that explode=false results in comma-separated query parameters in HTTP requests.
|
| 134 |
|
|
|
|
| 199 |
f"Expected 'red,blue,green', got '{tags_value}'"
|
| 200 |
)
|
| 201 |
|
|
|
|
| 202 |
async def test_explode_true_request_serialization(self):
|
| 203 |
"""Test that explode=true results in separate query parameters in HTTP requests."""
|
| 204 |
openapi_spec = {
|
|
|
|
| 259 |
f"Expected ['red', 'blue', 'green'], got {tags_value}"
|
| 260 |
)
|
| 261 |
|
|
|
|
| 262 |
async def test_explode_default_request_serialization(self):
|
| 263 |
"""Test that default behavior (no explode) uses explode=true for query parameters."""
|
| 264 |
openapi_spec = {
|