mirror of
https://github.com/home-assistant/core.git
synced 2025-08-30 18:01:31 +02:00
Fixes
This commit is contained in:
@@ -97,4 +97,8 @@ class WorkdayCalendarEntity(BaseWorkdayEntity, CalendarEntity):
|
|||||||
self, hass: HomeAssistant, start_date: datetime, end_date: datetime
|
self, hass: HomeAssistant, start_date: datetime, end_date: datetime
|
||||||
) -> list[CalendarEvent]:
|
) -> list[CalendarEvent]:
|
||||||
"""Get all events in a specific time frame."""
|
"""Get all events in a specific time frame."""
|
||||||
return self.event_list
|
return [
|
||||||
|
workday
|
||||||
|
for workday in self.event_list
|
||||||
|
if start_date.date() <= workday.start <= end_date.date()
|
||||||
|
]
|
||||||
|
@@ -40,14 +40,15 @@ async def test_holiday_calendar_entity(
|
|||||||
SERVICE_GET_EVENTS,
|
SERVICE_GET_EVENTS,
|
||||||
{
|
{
|
||||||
"entity_id": "calendar.workday_sensor_calendar",
|
"entity_id": "calendar.workday_sensor_calendar",
|
||||||
"end_date_time": dt_util.now() + timedelta(hours=1),
|
"start_date_time": dt_util.now(),
|
||||||
|
"end_date_time": dt_util.now() + timedelta(days=10, hours=1),
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
return_response=True,
|
return_response=True,
|
||||||
)
|
)
|
||||||
assert {
|
assert {
|
||||||
"end": "2023-01-01",
|
"end": "2023-01-02",
|
||||||
"start": "2023-01-02",
|
"start": "2023-01-01",
|
||||||
"summary": "Workday Sensor",
|
"summary": "Workday Sensor",
|
||||||
} not in response["calendar.workday_sensor_calendar"]["events"]
|
} not in response["calendar.workday_sensor_calendar"]["events"]
|
||||||
assert {
|
assert {
|
||||||
|
Reference in New Issue
Block a user