mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Android TV Remote: Fix missing key and cert when adding a device via IP address (#97953)
Fix missing key and cert
This commit is contained in:
parent
eff7b8f81a
commit
0a2ff3a676
@ -58,6 +58,7 @@ class AndroidTVRemoteConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
assert self.host
|
||||
api = create_api(self.hass, self.host, enable_ime=False)
|
||||
try:
|
||||
await api.async_generate_cert_if_missing()
|
||||
self.name, self.mac = await api.async_get_name_and_mac()
|
||||
assert self.mac
|
||||
await self.async_set_unique_id(format_mac(self.mac))
|
||||
|
@ -90,6 +90,7 @@ async def test_user_flow_cannot_connect(
|
||||
|
||||
host = "1.2.3.4"
|
||||
|
||||
mock_api.async_generate_cert_if_missing = AsyncMock(return_value=True)
|
||||
mock_api.async_get_name_and_mac = AsyncMock(side_effect=CannotConnect())
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -101,6 +102,7 @@ async def test_user_flow_cannot_connect(
|
||||
assert "host" in result["data_schema"].schema
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
mock_api.async_generate_cert_if_missing.assert_called()
|
||||
mock_api.async_get_name_and_mac.assert_called()
|
||||
mock_api.async_start_pairing.assert_not_called()
|
||||
|
||||
@ -329,6 +331,7 @@ async def test_user_flow_already_configured_host_changed_reloads_entry(
|
||||
assert "host" in result["data_schema"].schema
|
||||
assert not result["errors"]
|
||||
|
||||
mock_api.async_generate_cert_if_missing = AsyncMock(return_value=True)
|
||||
mock_api.async_get_name_and_mac = AsyncMock(return_value=(name, mac))
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -338,6 +341,7 @@ async def test_user_flow_already_configured_host_changed_reloads_entry(
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
||||
mock_api.async_generate_cert_if_missing.assert_called()
|
||||
mock_api.async_get_name_and_mac.assert_called()
|
||||
mock_api.async_start_pairing.assert_not_called()
|
||||
|
||||
@ -386,6 +390,7 @@ async def test_user_flow_already_configured_host_not_changed_no_reload_entry(
|
||||
assert "host" in result["data_schema"].schema
|
||||
assert not result["errors"]
|
||||
|
||||
mock_api.async_generate_cert_if_missing = AsyncMock(return_value=True)
|
||||
mock_api.async_get_name_and_mac = AsyncMock(return_value=(name, mac))
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
@ -395,6 +400,7 @@ async def test_user_flow_already_configured_host_not_changed_no_reload_entry(
|
||||
assert result.get("type") == FlowResultType.ABORT
|
||||
assert result.get("reason") == "already_configured"
|
||||
|
||||
mock_api.async_generate_cert_if_missing.assert_called()
|
||||
mock_api.async_get_name_and_mac.assert_called()
|
||||
mock_api.async_start_pairing.assert_not_called()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user