diff --git a/tests/components/devolo_home_control/test_config_flow.py b/tests/components/devolo_home_control/test_config_flow.py index dd856d2e6b5..7d2c9ce40f6 100644 --- a/tests/components/devolo_home_control/test_config_flow.py +++ b/tests/components/devolo_home_control/test_config_flow.py @@ -1,6 +1,8 @@ """Test the devolo_home_control config flow.""" from unittest.mock import patch +import pytest + from homeassistant import config_entries, data_entry_flow, setup from homeassistant.components.devolo_home_control.const import DOMAIN from homeassistant.config_entries import SOURCE_USER @@ -24,9 +26,6 @@ async def test_form(hass): "homeassistant.components.devolo_home_control.async_setup_entry", return_value=True, ) as mock_setup_entry, patch( - "homeassistant.components.devolo_home_control.config_flow.Mydevolo.credentials_valid", - return_value=True, - ), patch( "homeassistant.components.devolo_home_control.config_flow.Mydevolo.uuid", return_value="123456", ): @@ -48,6 +47,7 @@ async def test_form(hass): assert len(mock_setup_entry.mock_calls) == 1 +@pytest.mark.credentials_invalid async def test_form_invalid_credentials(hass): """Test if we get the error message on invalid credentials.""" await setup.async_setup_component(hass, "persistent_notification", {}) @@ -57,16 +57,12 @@ async def test_form_invalid_credentials(hass): assert result["type"] == "form" assert result["errors"] == {} - with patch( - "homeassistant.components.devolo_home_control.config_flow.Mydevolo.credentials_valid", - return_value=False, - ): - result = await hass.config_entries.flow.async_configure( - result["flow_id"], - {"username": "test-username", "password": "test-password"}, - ) + result = await hass.config_entries.flow.async_configure( + result["flow_id"], + {"username": "test-username", "password": "test-password"}, + ) - assert result["errors"] == {"base": "invalid_auth"} + assert result["errors"] == {"base": "invalid_auth"} async def test_form_already_configured(hass): @@ -74,9 +70,6 @@ async def test_form_already_configured(hass): with patch( "homeassistant.components.devolo_home_control.config_flow.Mydevolo.uuid", return_value="123456", - ), patch( - "homeassistant.components.devolo_home_control.config_flow.Mydevolo.credentials_valid", - return_value=True, ): MockConfigEntry(domain=DOMAIN, unique_id="123456", data={}).add_to_hass(hass) result = await hass.config_entries.flow.async_init( @@ -103,9 +96,6 @@ async def test_form_advanced_options(hass): "homeassistant.components.devolo_home_control.async_setup_entry", return_value=True, ) as mock_setup_entry, patch( - "homeassistant.components.devolo_home_control.config_flow.Mydevolo.credentials_valid", - return_value=True, - ), patch( "homeassistant.components.devolo_home_control.config_flow.Mydevolo.uuid", return_value="123456", ):