forked from openstack-kr/python-openstackmcp-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_network_prompts.py
More file actions
31 lines (22 loc) · 985 Bytes
/
Copy pathtest_network_prompts.py
File metadata and controls
31 lines (22 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from unittest.mock import MagicMock
from fastmcp import FastMCP
from openstack_mcp_server.prompts import register_prompt
class TestPrompts:
"""Test cases for MCP prompts."""
def test_get_servers_by_security_group_prompt_registered(self):
"""Test that the prompt is registered with the MCP instance."""
mcp = MagicMock()
register_prompt(mcp)
mcp.prompt.assert_called()
def test_get_servers_by_security_group_prompt_content(self):
"""Test that the prompt returns expected content."""
mcp = FastMCP("test")
register_prompt(mcp)
prompts = mcp._prompt_manager._prompts
assert "get_servers_by_security_group" in prompts
prompt_obj = prompts["get_servers_by_security_group"]
assert prompt_obj.fn is not None
result = prompt_obj.fn(security_group_name="my-sg")
assert "my-sg" in result
assert "get_servers" in result
assert "security_groups" in result