Some checks failed
🧪 Integration Testing / 🔧 Test Integration (2023.12.0, 3.11) (push) Successful in 2m11s
🧪 Integration Testing / 🔧 Test Integration (2023.12.0, 3.12) (push) Successful in 2m2s
🧪 Integration Testing / 🔧 Test Integration (2024.1.0, 3.11) (push) Successful in 1m4s
🧪 Integration Testing / 🔧 Test Integration (2024.1.0, 3.12) (push) Successful in 1m19s
🛡️ Code Quality & Security Check / 🔍 Code Quality Analysis (push) Failing after 56s
Signed-off-by: Rafal Zielinski <sq4ind@gmail.com>
29 lines
932 B
Python
29 lines
932 B
Python
"""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" |