From 855559004bec7eccb79594c056ec6e17c41be1c8 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 25 Apr 2021 11:13:54 -1000 Subject: [PATCH] Drop unneeded async_setup from august (#49675) --- homeassistant/components/august/__init__.py | 7 +------ tests/components/august/test_config_flow.py | 14 -------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/homeassistant/components/august/__init__.py b/homeassistant/components/august/__init__.py index 041f24cc44f..7872c4e0307 100644 --- a/homeassistant/components/august/__init__.py +++ b/homeassistant/components/august/__init__.py @@ -33,12 +33,6 @@ API_CACHED_ATTRS = ( ) -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the August component from YAML.""" - hass.data.setdefault(DOMAIN, {}) - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up August from a config entry.""" @@ -85,6 +79,7 @@ async def async_setup_august(hass, config_entry, august_gateway): await august_gateway.async_authenticate() + hass.data.setdefault(DOMAIN, {}) data = hass.data[DOMAIN][config_entry.entry_id] = { DATA_AUGUST: AugustData(hass, august_gateway) } diff --git a/tests/components/august/test_config_flow.py b/tests/components/august/test_config_flow.py index 53dac38fb1e..ab5ea1e216b 100644 --- a/tests/components/august/test_config_flow.py +++ b/tests/components/august/test_config_flow.py @@ -34,8 +34,6 @@ async def test_form(hass): "homeassistant.components.august.config_flow.AugustGateway.async_authenticate", return_value=True, ), patch( - "homeassistant.components.august.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.august.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -57,7 +55,6 @@ async def test_form(hass): CONF_INSTALL_ID: None, CONF_ACCESS_TOKEN_CACHE_FILE: ".my@email.tld.august.conf", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -168,8 +165,6 @@ async def test_form_needs_validate(hass): "homeassistant.components.august.gateway.AuthenticatorAsync.async_send_verification_code", return_value=True, ) as mock_send_verification_code, patch( - "homeassistant.components.august.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.august.async_setup_entry", return_value=True ) as mock_setup_entry: result3 = await hass.config_entries.flow.async_configure( @@ -196,8 +191,6 @@ async def test_form_needs_validate(hass): "homeassistant.components.august.gateway.AuthenticatorAsync.async_send_verification_code", return_value=True, ) as mock_send_verification_code, patch( - "homeassistant.components.august.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.august.async_setup_entry", return_value=True ) as mock_setup_entry: result4 = await hass.config_entries.flow.async_configure( @@ -216,7 +209,6 @@ async def test_form_needs_validate(hass): CONF_INSTALL_ID: None, CONF_ACCESS_TOKEN_CACHE_FILE: ".my@email.tld.august.conf", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -247,8 +239,6 @@ async def test_form_reauth(hass): "homeassistant.components.august.config_flow.AugustGateway.async_authenticate", return_value=True, ), patch( - "homeassistant.components.august.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.august.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -262,7 +252,6 @@ async def test_form_reauth(hass): assert result2["type"] == "abort" assert result2["reason"] == "reauth_successful" - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -320,8 +309,6 @@ async def test_form_reauth_with_2fa(hass): "homeassistant.components.august.gateway.AuthenticatorAsync.async_send_verification_code", return_value=True, ) as mock_send_verification_code, patch( - "homeassistant.components.august.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.august.async_setup_entry", return_value=True ) as mock_setup_entry: result3 = await hass.config_entries.flow.async_configure( @@ -334,5 +321,4 @@ async def test_form_reauth_with_2fa(hass): assert len(mock_send_verification_code.mock_calls) == 0 assert result3["type"] == "abort" assert result3["reason"] == "reauth_successful" - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1