fix: validate date format in create_schedule with clear error message

This commit is contained in:
2026-03-09 20:36:55 -05:00
parent c670ea5bc9
commit 6154b83455
3 changed files with 120 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ import pytest
from unittest.mock import MagicMock, patch
import datetime
import json
from fastmcp.exceptions import ToolError
import sys
from pathlib import Path
@@ -78,6 +79,19 @@ class TestCreateSchedule:
},
)
async def test_create_schedule_invalid_date_format(self, mcp_client, mock_settings):
with pytest.raises(ToolError, match="Invalid date format"):
await mcp_client.call_tool(
"create_schedule",
{
"professional": 6,
"description": "Test appointment",
"customer": 4,
"date": "invalid-date",
"service_center": 11,
},
)
@pytest.mark.asyncio
class TestFindServiceCenters: