iAlarm small code quality improvements (#49126)
This commit is contained in:
parent
b98ca49a56
commit
de4b1eebdd
2 changed files with 5 additions and 24 deletions
|
@ -4,8 +4,7 @@
|
|||
"user": {
|
||||
"data": {
|
||||
"host": "[%key:common::config_flow::data::host%]",
|
||||
"port": "[%key:common::config_flow::data::port%]",
|
||||
"pin": "[%key:common::config_flow::data::pin%]"
|
||||
"port": "[%key:common::config_flow::data::port%]"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -11,7 +11,6 @@ from homeassistant.config_entries import (
|
|||
ENTRY_STATE_SETUP_RETRY,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
@ -38,17 +37,9 @@ async def test_setup_entry(hass, ialarm_api, mock_config_entry):
|
|||
ialarm_api.return_value.get_mac = Mock(return_value="00:00:54:12:34:56")
|
||||
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await async_setup_component(
|
||||
hass,
|
||||
DOMAIN,
|
||||
{
|
||||
"ialarm": {
|
||||
CONF_HOST: "192.168.10.20",
|
||||
CONF_PORT: 18034,
|
||||
},
|
||||
},
|
||||
)
|
||||
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
ialarm_api.return_value.get_mac.assert_called_once()
|
||||
assert mock_config_entry.state == ENTRY_STATE_LOADED
|
||||
|
||||
|
@ -58,7 +49,7 @@ async def test_setup_not_ready(hass, ialarm_api, mock_config_entry):
|
|||
ialarm_api.return_value.get_mac = Mock(side_effect=ConnectionError)
|
||||
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await async_setup_component(hass, DOMAIN, {})
|
||||
assert not await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
assert mock_config_entry.state == ENTRY_STATE_SETUP_RETRY
|
||||
|
||||
|
@ -68,16 +59,7 @@ async def test_unload_entry(hass, ialarm_api, mock_config_entry):
|
|||
ialarm_api.return_value.get_mac = Mock(return_value="00:00:54:12:34:56")
|
||||
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await async_setup_component(
|
||||
hass,
|
||||
DOMAIN,
|
||||
{
|
||||
"ialarm": {
|
||||
CONF_HOST: "192.168.10.20",
|
||||
CONF_PORT: 18034,
|
||||
},
|
||||
},
|
||||
)
|
||||
assert await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert mock_config_entry.state == ENTRY_STATE_LOADED
|
||||
|
|
Loading…
Add table
Reference in a new issue