hass-core/tests/components/gdacs/test_init.py
Malte Franken 8d429d7676
Add GDACS feed integration (#31235)
* initial version of gdacs integration

* updated translations

* generated files

* added abbreviation

* bumped library version

* small feed entry attribute fixes

* add unit tests

* need to use original mdi name

* bumped library version

* improved entity name for earthquakes

* round vulnerability number

* typo

* support for categories

* testing support for categories

* tie longitude and latitude together

* validating categories

* simplifying setup

* passing domain as parameter

* simplified test setup

* moved test code

* simplified test code

* removed superfluous code

* changed approach to unique identifier

* changed code structure

* simplified unit system handling

* made schema a constant

* comment added

* simplifying code

* added message if location already configured

* removed unnecessary code

* simplified test code

* avoid mocking __init__

* pylint

* simplified code

* fetch categories from integration library

* setting PARALLEL_UPDATES

* setting PARALLEL_UPDATES to zero/unlimited

* added quality scale
2020-02-06 11:32:30 +01:00

19 lines
894 B
Python

"""Define tests for the GDACS general setup."""
from asynctest import patch
from homeassistant.components.gdacs import DOMAIN, FEED
async def test_component_unload_config_entry(hass, config_entry):
"""Test that loading and unloading of a config entry works."""
config_entry.add_to_hass(hass)
with patch("aio_georss_gdacs.GdacsFeedManager.update") as mock_feed_manager_update:
# Load config entry.
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
assert mock_feed_manager_update.call_count == 1
assert hass.data[DOMAIN][FEED][config_entry.entry_id] is not None
# Unload config entry.
assert await hass.config_entries.async_unload(config_entry.entry_id)
await hass.async_block_till_done()
assert hass.data[DOMAIN][FEED].get(config_entry.entry_id) is None