hass-core/tests/components/nws/test_init.py
MatthewFlamm 6d812bd957
Add config flow to nws and remove yaml configuration (#34267)
* add config flow to nws and remove yaml

* Don't duplicate scan_time

Co-Authored-By: J. Nick Koston <nick@koston.org>

* Use _abort_if_unique_id_configured

Co-Authored-By: J. Nick Koston <nick@koston.org>

* fix abort

* Add unavailable tests

* update and use better strings

* lint

Co-authored-by: J. Nick Koston <nick@koston.org>
2020-04-16 09:15:55 -05:00

26 lines
930 B
Python

"""Tests for init module."""
from homeassistant.components.nws.const import DOMAIN
from homeassistant.components.weather import DOMAIN as WEATHER_DOMAIN
from tests.common import MockConfigEntry
from tests.components.nws.const import NWS_CONFIG
async def test_unload_entry(hass, mock_simple_nws):
"""Test that nws setup with config yaml."""
entry = MockConfigEntry(domain=DOMAIN, data=NWS_CONFIG,)
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert len(hass.states.async_entity_ids(WEATHER_DOMAIN)) == 2
assert DOMAIN in hass.data
assert len(hass.data[DOMAIN]) == 1
entries = hass.config_entries.async_entries(DOMAIN)
assert len(entries) == 1
assert await hass.config_entries.async_unload(entries[0].entry_id)
assert len(hass.states.async_entity_ids(WEATHER_DOMAIN)) == 0
assert DOMAIN not in hass.data