2024-02-26 16:10:11 +00:00
|
|
|
"""Tests for the Webmin integration."""
|
2024-03-08 13:44:56 +00:00
|
|
|
|
2024-02-26 16:10:11 +00:00
|
|
|
from homeassistant.components.webmin.const import DOMAIN
|
|
|
|
from homeassistant.config_entries import ConfigEntryState
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
|
|
|
2024-03-06 19:22:08 +00:00
|
|
|
from .conftest import async_init_integration
|
2024-02-26 16:10:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def test_unload_entry(hass: HomeAssistant) -> None:
|
|
|
|
"""Test successful unload of entry."""
|
|
|
|
|
2024-03-06 19:22:08 +00:00
|
|
|
entry = await async_init_integration(hass)
|
2024-02-26 16:10:11 +00:00
|
|
|
|
|
|
|
assert entry.state is ConfigEntryState.LOADED
|
|
|
|
|
|
|
|
assert await hass.config_entries.async_unload(entry.entry_id)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
assert entry.state is ConfigEntryState.NOT_LOADED
|
|
|
|
assert not hass.data.get(DOMAIN)
|
2024-07-19 08:01:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def test_entry_without_mac_address(hass: HomeAssistant) -> None:
|
|
|
|
"""Test an entry without MAC address."""
|
|
|
|
|
|
|
|
entry = await async_init_integration(hass, False)
|
|
|
|
|
|
|
|
assert entry.runtime_data.unique_id == entry.entry_id
|