mirror of
https://github.com/home-assistant/core.git
synced 2025-07-11 15:27:08 +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(
|
async def test_multiple_config_entries(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
component_setup: ComponentSetup,
|
component_setup: ComponentSetup,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
mock_calendars_list: ApiResult,
|
mock_calendars_list: ApiResult,
|
||||||
test_api_calendar: dict[str, Any],
|
test_api_calendar: dict[str, Any],
|
||||||
mock_events_list: ApiResult,
|
mock_events_list: ApiResult,
|
||||||
config_entry: MockConfigEntry,
|
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test finding a calendar from the API."""
|
"""Test finding a calendar from the API."""
|
||||||
|
|
||||||
|
mock_calendars_list({"items": [test_api_calendar]})
|
||||||
|
mock_events_list({})
|
||||||
|
|
||||||
assert await component_setup()
|
assert await component_setup()
|
||||||
|
|
||||||
config_entry1 = MockConfigEntry(
|
state = hass.states.get(TEST_API_ENTITY)
|
||||||
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")
|
|
||||||
assert state
|
assert state
|
||||||
assert state.state == STATE_OFF
|
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(
|
config_entry2 = MockConfigEntry(
|
||||||
domain=DOMAIN, data=config_entry.data, unique_id="other-address@example.com"
|
domain=DOMAIN, data=config_entry.data, unique_id="other-address@example.com"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user