"""Test config flow for AdGuard Control Hub.""" import pytest from homeassistant import config_entries, setup from custom_components.adguard_hub.const import DOMAIN async def test_config_flow_success(hass): """Test successful config flow.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["step_id"] == "user" async def test_config_flow_cannot_connect(hass): """Test config flow with connection error.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data={ "host": "invalid-host", "port": 3000, "username": "admin", "password": "password", }, ) assert result["type"] == "form" assert result["errors"]["base"] == "cannot_connect"