fix: fixes
Some checks failed
Integration Testing / Test Integration (2025.9.4, 3.13) (push) Failing after 19s
Code Quality Check / Code Quality Analysis (push) Successful in 10s

Signed-off-by: Rafal Zielinski <sq4ind@gmail.com>
This commit is contained in:
2025-09-28 16:25:28 +01:00
parent a97dff1c1b
commit 1aad59c582

View File

@@ -72,7 +72,7 @@ async def test_setup_entry_success(hass: HomeAssistant, mock_config_entry, mock_
"""Test successful setup of config entry.""" """Test successful setup of config entry."""
with patch("custom_components.adguard_hub.AdGuardHomeAPI", return_value=mock_api), \ with patch("custom_components.adguard_hub.AdGuardHomeAPI", return_value=mock_api), \
patch("custom_components.adguard_hub.async_get_clientsession"), \ patch("custom_components.adguard_hub.async_get_clientsession"), \
patch.object(hass.config_entries, "async_forward_entry_setups", AsyncMock(return_value=True)): patch.object(hass.config_entries, "async_forward_entry_setups", return_value=True):
result = await async_setup_entry(hass, mock_config_entry) result = await async_setup_entry(hass, mock_config_entry)
@@ -107,12 +107,11 @@ async def test_unload_entry(hass: HomeAssistant, mock_config_entry):
} }
} }
with patch.object(hass.config_entries, "async_unload_platforms", AsyncMock(return_value=True)): with patch.object(hass.config_entries, "async_unload_platforms", return_value=True):
result = await async_unload_entry(hass, mock_config_entry) result = await async_unload_entry(hass, mock_config_entry)
assert result is True assert result is True
# FIXED: Handle case where DOMAIN key is removed when last entry is unloaded assert mock_config_entry.entry_id not in hass.data[DOMAIN]
assert DOMAIN not in hass.data or mock_config_entry.entry_id not in hass.data[DOMAIN]
@pytest.mark.asyncio @pytest.mark.asyncio