25 lines
602 B
Python
25 lines
602 B
Python
"""测试 MCP Server"""
|
|
|
|
import pytest
|
|
from njupt_mcp.server import mcp
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_search_course():
|
|
"""测试课程搜索工具"""
|
|
from njupt_mcp.server import search_course
|
|
|
|
result = await search_course("数据结构", limit=2)
|
|
assert "CS2101" in result
|
|
assert "数据结构" in result
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_campus_info():
|
|
"""测试校园信息工具"""
|
|
from njupt_mcp.server import get_campus_info
|
|
|
|
result = await get_campus_info("overview")
|
|
assert "南京邮电大学" in result
|
|
assert "NJUPT" in result
|