Add name and slug to supervisor discovery info (#80094)

This commit is contained in:
Martin Hjelmare 2022-10-11 16:56:45 +02:00 committed by GitHub
parent 918243b7c8
commit 62c4cd3c26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 160 additions and 50 deletions

View file

@ -75,7 +75,11 @@ async def test_hassio_success(hass: HomeAssistant) -> None:
result = await hass.config_entries.flow.async_init(
DOMAIN,
data=HassioServiceInfo(config={"addon": "motionEye", "url": TEST_URL}),
data=HassioServiceInfo(
config={"addon": "motionEye", "url": TEST_URL},
name="motionEye",
slug="motioneye",
),
context={"source": config_entries.SOURCE_HASSIO},
)
@ -351,7 +355,11 @@ async def test_hassio_already_configured(hass: HomeAssistant) -> None:
result = await hass.config_entries.flow.async_init(
DOMAIN,
data=HassioServiceInfo(config={"addon": "motionEye", "url": TEST_URL}),
data=HassioServiceInfo(
config={"addon": "motionEye", "url": TEST_URL},
name="motionEye",
slug="motioneye",
),
context={"source": config_entries.SOURCE_HASSIO},
)
assert result.get("type") == data_entry_flow.FlowResultType.ABORT
@ -366,7 +374,11 @@ async def test_hassio_ignored(hass: HomeAssistant) -> None:
result = await hass.config_entries.flow.async_init(
DOMAIN,
data=HassioServiceInfo(config={"addon": "motionEye", "url": TEST_URL}),
data=HassioServiceInfo(
config={"addon": "motionEye", "url": TEST_URL},
name="motionEye",
slug="motioneye",
),
context={"source": config_entries.SOURCE_HASSIO},
)
assert result.get("type") == data_entry_flow.FlowResultType.ABORT
@ -382,7 +394,11 @@ async def test_hassio_abort_if_already_in_progress(hass: HomeAssistant) -> None:
result2 = await hass.config_entries.flow.async_init(
DOMAIN,
data=HassioServiceInfo(config={"addon": "motionEye", "url": TEST_URL}),
data=HassioServiceInfo(
config={"addon": "motionEye", "url": TEST_URL},
name="motionEye",
slug="motioneye",
),
context={"source": config_entries.SOURCE_HASSIO},
)
assert result2.get("type") == data_entry_flow.FlowResultType.ABORT
@ -394,7 +410,11 @@ async def test_hassio_clean_up_on_user_flow(hass: HomeAssistant) -> None:
result = await hass.config_entries.flow.async_init(
DOMAIN,
data=HassioServiceInfo(config={"addon": "motionEye", "url": TEST_URL}),
data=HassioServiceInfo(
config={"addon": "motionEye", "url": TEST_URL},
name="motionEye",
slug="motioneye",
),
context={"source": config_entries.SOURCE_HASSIO},
)
assert result.get("type") == data_entry_flow.FlowResultType.FORM