From 39e8a92596c03cdafdaf6377084ab55025de7901 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Fri, 30 Apr 2021 16:41:55 +0200 Subject: [PATCH] Remove unused code from Brother config flow (#49889) --- homeassistant/components/brother/config_flow.py | 5 ----- tests/components/brother/test_config_flow.py | 17 ----------------- 2 files changed, 22 deletions(-) diff --git a/homeassistant/components/brother/config_flow.py b/homeassistant/components/brother/config_flow.py index 0b6df361b23..13d21923269 100644 --- a/homeassistant/components/brother/config_flow.py +++ b/homeassistant/components/brother/config_flow.py @@ -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(".") diff --git a/tests/components/brother/test_config_flow.py b/tests/components/brother/test_config_flow.py index 532200cf2a6..c518076615a 100644 --- a/tests/components/brother/test_config_flow.py +++ b/tests/components/brother/test_config_flow.py @@ -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")):