Rework Melissa tests (#113241)
This commit is contained in:
parent
3e85b2ed12
commit
a136638719
7 changed files with 128 additions and 371 deletions
|
@ -1,25 +1,13 @@
|
|||
"""The test for the Melissa Climate component."""
|
||||
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from homeassistant.components import melissa
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
VALID_CONFIG = {"melissa": {"username": "********", "password": "********"}}
|
||||
from tests.components.melissa import setup_integration
|
||||
|
||||
|
||||
async def test_setup(hass: HomeAssistant) -> None:
|
||||
async def test_setup(hass: HomeAssistant, mock_melissa) -> None:
|
||||
"""Test setting up the Melissa component."""
|
||||
with patch("melissa.AsyncMelissa") as mocked_melissa, patch.object(
|
||||
melissa, "async_load_platform"
|
||||
):
|
||||
mocked_melissa.return_value.async_connect = AsyncMock()
|
||||
await melissa.async_setup(hass, VALID_CONFIG)
|
||||
await setup_integration(hass)
|
||||
|
||||
mocked_melissa.assert_called_with(username="********", password="********")
|
||||
|
||||
assert melissa.DATA_MELISSA in hass.data
|
||||
assert isinstance(
|
||||
hass.data[melissa.DATA_MELISSA],
|
||||
type(mocked_melissa.return_value),
|
||||
)
|
||||
mock_melissa.assert_called_with(username="********", password="********")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue