Axis discovery updates host address (#22632)
* Discovery can update host on existing entries * Add support in device to update host on entry update * Fix tests and listener * Fix hound comment * Fix failing tests from cleanup
This commit is contained in:
parent
6c14e7afa7
commit
8a0b210f87
7 changed files with 104 additions and 49 deletions
|
@ -9,30 +9,28 @@ from tests.common import mock_coro, MockConfigEntry
|
|||
|
||||
async def test_setup(hass):
|
||||
"""Test configured options for a device are loaded via config entry."""
|
||||
with patch.object(hass, 'config_entries') as mock_config_entries, \
|
||||
patch.object(axis, 'configured_devices', return_value={}):
|
||||
with patch.object(hass.config_entries, 'flow') as mock_config_flow:
|
||||
|
||||
assert await async_setup_component(hass, axis.DOMAIN, {
|
||||
axis.DOMAIN: {
|
||||
'device_name': {
|
||||
axis.CONF_HOST: '1.2.3.4',
|
||||
axis.config_flow.CONF_HOST: '1.2.3.4',
|
||||
axis.config_flow.CONF_PORT: 80,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
assert len(mock_config_entries.flow.mock_calls) == 1
|
||||
assert len(mock_config_flow.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_setup_device_already_configured(hass):
|
||||
"""Test already configured device does not configure a second."""
|
||||
with patch.object(hass, 'config_entries') as mock_config_entries, \
|
||||
patch.object(axis, 'configured_devices', return_value={'1.2.3.4'}):
|
||||
with patch.object(hass, 'config_entries') as mock_config_entries:
|
||||
|
||||
assert await async_setup_component(hass, axis.DOMAIN, {
|
||||
axis.DOMAIN: {
|
||||
'device_name': {
|
||||
axis.CONF_HOST: '1.2.3.4'
|
||||
axis.config_flow.CONF_HOST: '1.2.3.4'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue