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
This commit is contained in:
Allen Porter 2024-10-03 08:23:58 -07:00 committed by GitHub
parent 62b449e52c
commit c38f23400c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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."""
mock_calendars_list({"items": [test_api_calendar]})
mock_events_list({})
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": [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()
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"