mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
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:
parent
62b449e52c
commit
c38f23400c
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user