From c38f23400cd9456ea9e6cfea30df8406e0dffacd Mon Sep 17 00:00:00 2001 From: Allen Porter <allen@thebends.org> Date: Thu, 3 Oct 2024 08:23:58 -0700 Subject: [PATCH] Don't add the same config entry id twice in google tests (#127457) Don't add the same config entry id twice in the test --- tests/components/google/test_init.py | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/tests/components/google/test_init.py b/tests/components/google/test_init.py index cfcda18df3a..536a1440958 100644 --- a/tests/components/google/test_init.py +++ b/tests/components/google/test_init.py @@ -248,35 +248,23 @@ async def test_init_calendar( async def test_multiple_config_entries( hass: HomeAssistant, component_setup: ComponentSetup, + config_entry: MockConfigEntry, mock_calendars_list: ApiResult, test_api_calendar: dict[str, Any], mock_events_list: ApiResult, - config_entry: MockConfigEntry, aioclient_mock: AiohttpClientMocker, ) -> None: """Test finding a calendar from the API.""" - assert await component_setup() - - config_entry1 = MockConfigEntry( - domain=DOMAIN, data=config_entry.data, unique_id=EMAIL_ADDRESS - ) - calendar1 = { - **test_api_calendar, - "id": "calendar-id1", - "summary": "Example Calendar 1", - } + mock_calendars_list({"items": [test_api_calendar]}) + mock_events_list({}) - mock_calendars_list({"items": [calendar1]}) - mock_events_list({}, calendar_id="calendar-id1") - config_entry1.add_to_hass(hass) - await hass.config_entries.async_setup(config_entry1.entry_id) - await hass.async_block_till_done() + assert await component_setup() - state = hass.states.get("calendar.example_calendar_1") + state = hass.states.get(TEST_API_ENTITY) assert state assert state.state == STATE_OFF - assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Example calendar 1" + assert state.attributes.get(ATTR_FRIENDLY_NAME) == TEST_API_ENTITY_NAME config_entry2 = MockConfigEntry( domain=DOMAIN, data=config_entry.data, unique_id="other-address@example.com" -- GitLab