mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Swedish weather institute weather component (#16717)
* SMHI Component * Clean up typos * Fixed default values first config to home location (tests will follow) * Fixed tests and removed unused function * Minor fixup after comments from @kane610 * add support for precipitation in forecast * Removed old async_step_init not needed.
This commit is contained in:
committed by
Martin Hjelmare
parent
56a43436d7
commit
540d22d603
39
tests/components/smhi/test_init.py
Normal file
39
tests/components/smhi/test_init.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""Test SMHI component setup process."""
|
||||
from unittest.mock import Mock
|
||||
|
||||
from homeassistant.components import smhi
|
||||
|
||||
from .common import AsyncMock
|
||||
|
||||
TEST_CONFIG = {
|
||||
"config": {
|
||||
"name": "0123456789ABCDEF",
|
||||
"longitude": "62.0022",
|
||||
"latitude": "17.0022"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async def test_setup_always_return_true() -> None:
|
||||
"""Test async_setup always returns True."""
|
||||
hass = Mock()
|
||||
# Returns true with empty config
|
||||
assert await smhi.async_setup(hass, {}) is True
|
||||
|
||||
# Returns true with a config provided
|
||||
assert await smhi.async_setup(hass, TEST_CONFIG) is True
|
||||
|
||||
|
||||
async def test_forward_async_setup_entry() -> None:
|
||||
"""Test that it will forward setup entry."""
|
||||
hass = Mock()
|
||||
|
||||
assert await smhi.async_setup_entry(hass, {}) is True
|
||||
assert len(hass.config_entries.async_forward_entry_setup.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_forward_async_unload_entry() -> None:
|
||||
"""Test that it will forward unload entry."""
|
||||
hass = AsyncMock()
|
||||
assert await smhi.async_unload_entry(hass, {}) is True
|
||||
assert len(hass.config_entries.async_forward_entry_unload.mock_calls) == 1
|
||||
Reference in New Issue
Block a user