mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Remove unused code from Brother config flow (#49889)
This commit is contained in:
parent
fdc29d6a80
commit
39e8a92596
@ -84,11 +84,6 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
self, discovery_info: DiscoveryInfoType
|
||||
) -> FlowResult:
|
||||
"""Handle zeroconf discovery."""
|
||||
if not discovery_info.get("name") or not discovery_info["name"].startswith(
|
||||
"Brother"
|
||||
):
|
||||
return self.async_abort(reason="not_brother_printer")
|
||||
|
||||
# Hostname is format: brother.local.
|
||||
self.host = discovery_info["hostname"].rstrip(".")
|
||||
|
||||
|
@ -136,23 +136,6 @@ async def test_device_exists_abort(hass):
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
async def test_zeroconf_not_brother_printer_error(hass):
|
||||
"""Test we abort zeroconf flow if printer isn't Brother."""
|
||||
with patch(
|
||||
"brother.Brother._get_data",
|
||||
return_value=json.loads(load_fixture("brother_printer_data.json")),
|
||||
):
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_ZEROCONF},
|
||||
data={"hostname": "example.local.", "name": "Another Printer"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["reason"] == "not_brother_printer"
|
||||
|
||||
|
||||
async def test_zeroconf_snmp_error(hass):
|
||||
"""Test we abort zeroconf flow on SNMP error."""
|
||||
with patch("brother.Brother._get_data", side_effect=SnmpError("error")):
|
||||
|
Loading…
x
Reference in New Issue
Block a user