Add location field to calendar create_event service supported by Google Calendar and Local Calendar (#90098)

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update calendar.py

* Update calendar.py

* Update services.yaml

* Update services.yaml

* Update calendar.py

* Update calendar.py

* Update __init__.py

* Update services.yaml

* Update services.yaml

* Update test_calendar.py

* Update test_init.py

* Update test_init.py

* Update test_init.py

* Update test_init.py

* Update __init__.py

* Update const.py

* Address changes to service.yaml

* Address changes to service.yaml

* Update test_calendar.py

* Update test_calendar.py

* Update test_calendar.py

* Update conftest.py

* Update conftest.py

* Update calendar.py

* Update __init__.py
This commit is contained in:
Luca Angemi
2023-03-25 09:43:49 -07:00
committed by GitHub
parent 02ef7d445d
commit 6d8eaa0bee
11 changed files with 37 additions and 1 deletions
+2
View File
@@ -888,6 +888,7 @@ async def test_websocket_create(
assert aioclient_mock.mock_calls[0][2] == {
"summary": "Bastille Day Party",
"description": None,
"location": None,
"start": {
"dateTime": "1997-07-14T11:00:00-06:00",
"timeZone": "America/Regina",
@@ -931,6 +932,7 @@ async def test_websocket_create_all_day(
assert aioclient_mock.mock_calls[0][2] == {
"summary": "Bastille Day Party",
"description": None,
"location": None,
"start": {
"date": "1997-07-14",
},
+5
View File
@@ -42,6 +42,7 @@ HassApi = Callable[[], Awaitable[dict[str, Any]]]
TEST_EVENT_SUMMARY = "Test Summary"
TEST_EVENT_DESCRIPTION = "Test Description"
TEST_EVENT_LOCATION = "Test Location"
def assert_state(actual: State | None, expected: State | None) -> None:
@@ -93,6 +94,7 @@ def add_event_call_service(
**params,
"summary": TEST_EVENT_SUMMARY,
"description": TEST_EVENT_DESCRIPTION,
"location": TEST_EVENT_LOCATION,
},
target=target,
blocking=True,
@@ -484,6 +486,7 @@ async def test_add_event_date_in_x(
assert aioclient_mock.mock_calls[0][2] == {
"summary": TEST_EVENT_SUMMARY,
"description": TEST_EVENT_DESCRIPTION,
"location": TEST_EVENT_LOCATION,
"start": {"date": start_date.date().isoformat()},
"end": {"date": end_date.date().isoformat()},
}
@@ -524,6 +527,7 @@ async def test_add_event_date(
assert aioclient_mock.mock_calls[0][2] == {
"summary": TEST_EVENT_SUMMARY,
"description": TEST_EVENT_DESCRIPTION,
"location": TEST_EVENT_LOCATION,
"start": {"date": today.isoformat()},
"end": {"date": end_date.isoformat()},
}
@@ -564,6 +568,7 @@ async def test_add_event_date_time(
assert aioclient_mock.mock_calls[0][2] == {
"summary": TEST_EVENT_SUMMARY,
"description": TEST_EVENT_DESCRIPTION,
"location": TEST_EVENT_LOCATION,
"start": {
"dateTime": start_datetime.isoformat(timespec="seconds"),
"timeZone": "America/Regina",
+3 -1
View File
@@ -108,7 +108,9 @@ def get_events_fixture(hass_client: ClientSessionGenerator) -> GetEventsFn:
def event_fields(data: dict[str, str]) -> dict[str, str]:
"""Filter event API response to minimum fields."""
return {
k: data[k] for k in ["summary", "start", "end", "recurrence_id"] if data.get(k)
k: data[k]
for k in ["summary", "start", "end", "recurrence_id", "location"]
if data.get(k)
}
@@ -873,6 +873,7 @@ async def test_create_event_service(
"start_date_time": start_date_time,
"end_date_time": end_date_time,
"summary": "Bastille Day Party",
"location": "Test Location",
},
target={"entity_id": TEST_ENTITY},
blocking=True,
@@ -886,6 +887,7 @@ async def test_create_event_service(
"summary": "Bastille Day Party",
"start": {"dateTime": "1997-07-14T11:00:00-06:00"},
"end": {"dateTime": "1997-07-14T22:00:00-06:00"},
"location": "Test Location",
}
]
@@ -895,6 +897,7 @@ async def test_create_event_service(
"summary": "Bastille Day Party",
"start": {"dateTime": "1997-07-14T11:00:00-06:00"},
"end": {"dateTime": "1997-07-14T22:00:00-06:00"},
"location": "Test Location",
}
]
@@ -909,5 +912,6 @@ async def test_create_event_service(
"summary": "Bastille Day Party",
"start": {"dateTime": "1997-07-14T11:00:00-06:00"},
"end": {"dateTime": "1997-07-14T22:00:00-06:00"},
"location": "Test Location",
}
]