Remove unused code from Brother config flow (#49889)

This commit is contained in:
Maciej Bieniek 2021-04-30 16:41:55 +02:00 committed by GitHub
parent fdc29d6a80
commit 39e8a92596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 22 deletions

View File

@ -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(".")

View File

@ -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")):