Use repair issue when port enable fails in Reolink (#89591)
* Reolink use repair issue for disabled ports * fix styling * Add port repair issue tests * Update homeassistant/components/reolink/strings.json Co-authored-by: Erik Montnemery <erik@montnemery.com> --------- Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
parent
62bd2e97f5
commit
6e10cd81dd
3 changed files with 46 additions and 14 deletions
|
@ -86,7 +86,7 @@ async def test_entry_reloading(
|
|||
assert config_entry.title == "New Name"
|
||||
|
||||
|
||||
async def test_http_no_repair_issue(
|
||||
async def test_no_repair_issue(
|
||||
hass: HomeAssistant, config_entry: MockConfigEntry
|
||||
) -> None:
|
||||
"""Test no repairs issue is raised when http local url is used."""
|
||||
|
@ -99,6 +99,7 @@ async def test_http_no_repair_issue(
|
|||
|
||||
issue_registry = ir.async_get(hass)
|
||||
assert (const.DOMAIN, "https_webhook") not in issue_registry.issues
|
||||
assert (const.DOMAIN, "enable_port") not in issue_registry.issues
|
||||
|
||||
|
||||
async def test_https_repair_issue(
|
||||
|
@ -114,3 +115,23 @@ async def test_https_repair_issue(
|
|||
|
||||
issue_registry = ir.async_get(hass)
|
||||
assert (const.DOMAIN, "https_webhook") in issue_registry.issues
|
||||
|
||||
|
||||
@pytest.mark.parametrize("protocol", ["rtsp", "rtmp"])
|
||||
async def test_port_repair_issue(
|
||||
hass: HomeAssistant,
|
||||
config_entry: MockConfigEntry,
|
||||
reolink_connect: MagicMock,
|
||||
protocol: str,
|
||||
) -> None:
|
||||
"""Test repairs issue is raised when auto enable of ports fails."""
|
||||
reolink_connect.set_net_port = AsyncMock(side_effect=ReolinkError("Test error"))
|
||||
reolink_connect.onvif_enabled = False
|
||||
reolink_connect.rtsp_enabled = False
|
||||
reolink_connect.rtmp_enabled = False
|
||||
reolink_connect.protocol = protocol
|
||||
assert await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
issue_registry = ir.async_get(hass)
|
||||
assert (const.DOMAIN, "enable_port") in issue_registry.issues
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue