Add discovery support to HEOS component (#22652)
* Add discovery entry point * Fix test * Correct test call method * Update netdisco to 2.6.0
This commit is contained in:
@@ -55,3 +55,28 @@ async def test_create_entry_when_host_valid(hass, controller):
|
||||
assert result['data'] == data
|
||||
assert controller.connect.call_count == 1
|
||||
assert controller.disconnect.call_count == 1
|
||||
|
||||
|
||||
async def test_create_entry_with_discovery(hass, controller):
|
||||
"""Test result type is create entry when valid through discovery."""
|
||||
flow = HeosFlowHandler()
|
||||
flow.hass = hass
|
||||
data = {
|
||||
'host': '127.0.0.1',
|
||||
'manufacturer': 'Denon',
|
||||
'model_name': 'HEOS Drive',
|
||||
'model_number': 'DWSA-10 4.0',
|
||||
'name': 'Office',
|
||||
'port': 60006,
|
||||
'serial': None,
|
||||
'ssdp_description':
|
||||
'http://127.0.0.1:60006/upnp/desc/aios_device/aios_device.xml',
|
||||
'udn': 'uuid:e61de70c-2250-1c22-0080-0005cdf512be',
|
||||
'upnp_device_type': 'urn:schemas-denon-com:device:AiosDevice:1'
|
||||
}
|
||||
result = await flow.async_step_discovery(data)
|
||||
assert result['type'] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result['title'] == 'Controller (127.0.0.1)'
|
||||
assert result['data'] == {'host': '127.0.0.1'}
|
||||
assert controller.connect.call_count == 1
|
||||
assert controller.disconnect.call_count == 1
|
||||
|
||||
Reference in New Issue
Block a user