Add back description and location to calendar endpoint (#71887)

This commit is contained in:
Matej Drobnič 2022-05-15 20:31:22 +02:00 committed by GitHub
parent b6c7422607
commit 690fb2ae86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 0 deletions

View File

@ -341,6 +341,8 @@ class CalendarEventView(http.HomeAssistantView):
[
{
"summary": event.summary,
"description": event.description,
"location": event.location,
"start": _get_api_date(event.start),
"end": _get_api_date(event.end),
}

View File

@ -39,6 +39,8 @@ def calendar_data_future() -> CalendarEvent:
start=one_hour_from_now,
end=one_hour_from_now + datetime.timedelta(minutes=60),
summary="Future Event",
description="Future Description",
location="Future Location",
)
@ -90,6 +92,8 @@ class LegacyDemoCalendar(CalendarEventDevice):
).isoformat()
},
"summary": "Future Event",
"description": "Future Description",
"location": "Future Location",
}
@property

View File

@ -937,5 +937,7 @@ async def test_get_events_custom_calendars(hass, calendar, get_api_events):
"end": {"dateTime": "2017-11-27T10:00:00-08:00"},
"start": {"dateTime": "2017-11-27T09:00:00-08:00"},
"summary": "This is a normal event",
"location": "Hamburg",
"description": "Surprisingly rainy",
}
]

View File

@ -57,3 +57,5 @@ async def test_events_http_api_shim(hass, hass_client):
assert response.status == HTTPStatus.OK
events = await response.json()
assert events[0]["summary"] == "Future Event"
assert events[0]["description"] == "Future Description"
assert events[0]["location"] == "Future Location"

View File

@ -79,4 +79,6 @@ async def test_api_events(
"start": {"date": "2022-01-06"},
"end": {"date": "2022-01-06"},
"summary": "Christmas Tree Pickup",
"description": None,
"location": None,
}