fix: validate date format in create_schedule with clear error message
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user