Fix inkbird config flow tests to correctly test discovery and user flow (#75638)

* Fix inkbird config flow tests to correctly test discovery and user flow

* Fix inkbird config flow tests to correctly test discovery and user flow
This commit is contained in:
J. Nick Koston 2022-07-22 17:43:13 -05:00 committed by GitHub
parent 5b555066ea
commit 88b9a51811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,12 +141,24 @@ async def test_async_step_user_takes_precedence_over_discovery(hass):
assert result["step_id"] == "bluetooth_confirm"
with patch(
"homeassistant.components.sensorpush.async_setup_entry", return_value=True
"homeassistant.components.inkbird.config_flow.async_discovered_service_info",
return_value=[SPS_SERVICE_INFO],
):
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_USER},
)
assert result["type"] == FlowResultType.FORM
with patch("homeassistant.components.inkbird.async_setup_entry", return_value=True):
result2 = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input={}
result["flow_id"],
user_input={"address": "61DE521B-F0BF-9F44-64D4-75BBE1738105"},
)
assert result2["type"] == FlowResultType.CREATE_ENTRY
assert result2["title"] == "IBS-TH 75BBE1738105"
assert result2["data"] == {}
assert result2["result"].unique_id == "61DE521B-F0BF-9F44-64D4-75BBE1738105"
# Verify the original one was aborted
assert not hass.config_entries.flow.async_progress(DOMAIN)