Skip to main content
Glama

Office MCP Server

by walkingzzzy
test_file_manager.py1.15 kB
"""测试文件管理器.""" import pytest from pathlib import Path from office_mcp_server.utils.file_manager import FileManager def test_validate_file_path_valid() -> None: """测试验证有效文件路径.""" path = FileManager.validate_file_path("test.docx") assert isinstance(path, Path) assert path.name == "test.docx" def test_validate_file_path_invalid() -> None: """测试验证无效文件路径.""" with pytest.raises(ValueError): FileManager.validate_file_path("") def test_validate_file_extension_valid() -> None: """测试验证有效文件扩展名.""" assert FileManager.validate_file_extension("test.docx", [".docx", ".doc"]) def test_validate_file_extension_invalid() -> None: """测试验证无效文件扩展名.""" with pytest.raises(ValueError): FileManager.validate_file_extension("test.pdf", [".docx", ".doc"]) def test_get_temp_file_path() -> None: """测试获取临时文件路径.""" temp_path = FileManager.get_temp_file_path(prefix="test_", suffix=".tmp") assert temp_path.name.startswith("test_") assert temp_path.suffix == ".tmp"

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/walkingzzzy/office-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server