mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Finish config flow in huawei_lte SSDP test (#147542)
This commit is contained in:
parent
0be0e22e76
commit
5129f89086
@ -330,10 +330,7 @@ async def test_ssdp(
|
||||
url = FIXTURE_USER_INPUT[CONF_URL][:-1] # strip trailing slash for appending port
|
||||
context = {"source": config_entries.SOURCE_SSDP}
|
||||
login_requests_mock.request(**requests_mock_request_kwargs)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context=context,
|
||||
data=SsdpServiceInfo(
|
||||
service_info = SsdpServiceInfo(
|
||||
ssdp_usn="mock_usn",
|
||||
ssdp_st="upnp:rootdevice",
|
||||
ssdp_location=f"{url}:60957/rootDesc.xml",
|
||||
@ -347,7 +344,11 @@ async def test_ssdp(
|
||||
ATTR_UPNP_UDN: "uuid:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
|
||||
**upnp_data,
|
||||
},
|
||||
),
|
||||
)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context=context,
|
||||
data=service_info,
|
||||
)
|
||||
|
||||
for k, v in expected_result.items():
|
||||
@ -356,6 +357,23 @@ async def test_ssdp(
|
||||
assert result["data_schema"] is not None
|
||||
assert result["data_schema"]({})[CONF_URL] == url + "/"
|
||||
|
||||
if result["type"] == FlowResultType.ABORT:
|
||||
return
|
||||
|
||||
login_requests_mock.request(
|
||||
ANY,
|
||||
f"{FIXTURE_USER_INPUT[CONF_URL]}api/user/login",
|
||||
text="<response>OK</response>",
|
||||
)
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] == FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == service_info.upnp[ATTR_UPNP_MODEL_NAME]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("login_response_text", "expected_result", "expected_entry_data"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user