diff --git a/tests/__init__.py b/tests/__init__.py index 956652d..09b7797 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,3 +1,11 @@ """Tests for the Alpa Innotec integration.""" MODULE = "custom_components.alpha_innotec" + +VALID_CONFIG = { + "gateway_ip": "127.0.0.1", + "gateway_password": "verysafe", + "controller_ip": "127.0.0.2", + "controller_username": "testing", + "controller_password": "alsoverysafe" +} \ No newline at end of file diff --git a/tests/__pycache__/__init__.cpython-311.pyc b/tests/__pycache__/__init__.cpython-311.pyc index 9cdb370..a5bc25b 100644 Binary files a/tests/__pycache__/__init__.cpython-311.pyc and b/tests/__pycache__/__init__.cpython-311.pyc differ diff --git a/tests/__pycache__/test_config_flow.cpython-311-pytest-7.3.1.pyc b/tests/__pycache__/test_config_flow.cpython-311-pytest-7.3.1.pyc index b7f8f33..192b755 100644 Binary files a/tests/__pycache__/test_config_flow.cpython-311-pytest-7.3.1.pyc and b/tests/__pycache__/test_config_flow.cpython-311-pytest-7.3.1.pyc differ diff --git a/tests/fixtures/systeminformation.json b/tests/fixtures/controller_api_systeminformation.json similarity index 100% rename from tests/fixtures/systeminformation.json rename to tests/fixtures/controller_api_systeminformation.json diff --git a/tests/test_config_flow.py b/tests/test_config_flow.py index d952cf3..60a504d 100644 --- a/tests/test_config_flow.py +++ b/tests/test_config_flow.py @@ -2,21 +2,16 @@ import json from unittest.mock import patch from homeassistant import config_entries, setup +from homeassistant.core import HomeAssistant + from custom_components.alpha_innotec.const import DOMAIN from homeassistant.data_entry_flow import FlowResultType from pytest_homeassistant_custom_component.common import load_fixture -from . import MODULE +from . import MODULE, VALID_CONFIG -VALID_CONFIG = { - "gateway_ip": "127.0.0.1", - "gateway_password": "verysafe", - "controller_ip": "127.0.0.2", - "controller_username": "testing", - "controller_password": "alsoverysafe" -} -async def test_setup_config(hass): +async def test_setup_config(hass: HomeAssistant): """Test we get the form.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( @@ -27,7 +22,7 @@ async def test_setup_config(hass): with patch( target=f"{MODULE}.config_flow.validate_input", - return_value=json.loads(load_fixture("systeminformation.json")), + return_value=json.loads(load_fixture("controller_api_systeminformation.json")), ) as mock_setup_entry: result = await hass.config_entries.flow.async_configure( result["flow_id"],