better web tests
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.smoke
|
||||
|
||||
|
||||
class TestMcpPromptSurface:
|
||||
"""Covers smoke-level MCP prompt discovery and retrieval paths."""
|
||||
|
||||
class TestPromptDiscovery:
|
||||
"""Covers MCP prompts/list behavior using native prompt objects."""
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_lists_prompt_objects(self, mcp_session_factory) -> None:
|
||||
"""Ensures prompts/list returns native prompt objects with stable names."""
|
||||
async with mcp_session_factory() as mcp_session:
|
||||
result = await mcp_session.list_prompts()
|
||||
|
||||
assert result.prompts
|
||||
assert all(prompt.name for prompt in result.prompts)
|
||||
|
||||
class TestPromptResolution:
|
||||
"""Covers MCP prompts/get behavior using native request and response objects."""
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_gets_prompt_as_native_object(self, mcp_session_factory) -> None:
|
||||
"""Ensures prompts/get resolves a listed prompt into structured message objects."""
|
||||
async with mcp_session_factory() as mcp_session:
|
||||
listed_prompts = await mcp_session.list_prompts()
|
||||
prompt_name = listed_prompts.prompts[0].name
|
||||
|
||||
resolved_prompt = await mcp_session.get_prompt(name=prompt_name)
|
||||
|
||||
assert resolved_prompt.messages
|
||||
assert all(message.content for message in resolved_prompt.messages)
|
||||
Reference in New Issue
Block a user