Fix Mealie mealplan service date parsing (#121844)

This commit is contained in:
Joost Lekkerkerker 2024-07-12 15:21:48 +02:00 committed by GitHub
parent 3ef1e5816e
commit 12384104f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 8 deletions

View file

@ -19,6 +19,7 @@ from homeassistant.core import (
SupportsResponse,
)
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
from homeassistant.helpers import config_validation as cv
from .const import (
ATTR_CONFIG_ENTRY_ID,
@ -35,8 +36,8 @@ SERVICE_GET_MEALPLAN = "get_mealplan"
SERVICE_GET_MEALPLAN_SCHEMA = vol.Schema(
{
vol.Required(ATTR_CONFIG_ENTRY_ID): str,
vol.Optional(ATTR_START_DATE): date,
vol.Optional(ATTR_END_DATE): date,
vol.Optional(ATTR_START_DATE): cv.date,
vol.Optional(ATTR_END_DATE): cv.date,
}
)

View file

@ -65,8 +65,8 @@ async def test_service_mealplan(
SERVICE_GET_MEALPLAN,
{
ATTR_CONFIG_ENTRY_ID: mock_config_entry.entry_id,
ATTR_START_DATE: date(2023, 10, 22),
ATTR_END_DATE: date(2023, 10, 25),
ATTR_START_DATE: "2023-10-22",
ATTR_END_DATE: "2023-10-25",
},
blocking=True,
return_response=True,
@ -82,7 +82,7 @@ async def test_service_mealplan(
SERVICE_GET_MEALPLAN,
{
ATTR_CONFIG_ENTRY_ID: mock_config_entry.entry_id,
ATTR_START_DATE: date(2023, 10, 19),
ATTR_START_DATE: "2023-10-19",
},
blocking=True,
return_response=True,
@ -98,7 +98,7 @@ async def test_service_mealplan(
SERVICE_GET_MEALPLAN,
{
ATTR_CONFIG_ENTRY_ID: mock_config_entry.entry_id,
ATTR_END_DATE: date(2023, 10, 22),
ATTR_END_DATE: "2023-10-22",
},
blocking=True,
return_response=True,
@ -115,8 +115,8 @@ async def test_service_mealplan(
SERVICE_GET_MEALPLAN,
{
ATTR_CONFIG_ENTRY_ID: mock_config_entry.entry_id,
ATTR_START_DATE: date(2023, 10, 22),
ATTR_END_DATE: date(2023, 10, 19),
ATTR_START_DATE: "2023-10-22",
ATTR_END_DATE: "2023-10-19",
},
blocking=True,
return_response=True,