Homekit Bugfixes (#14689)

* Fix async bug
* Fix debounce bug
This commit is contained in:
cdce8p 2018-05-30 12:39:27 +02:00 committed by GitHub
parent e746b92e0e
commit f1f4d80f24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 30 deletions

View file

@ -26,7 +26,7 @@ async def test_debounce(hass):
arguments = None
counter = 0
mock = Mock(hass=hass)
mock = Mock(hass=hass, debounce={})
debounce_demo = debounce(demo_func)
assert debounce_demo.__name__ == 'demo_func'
@ -76,6 +76,7 @@ async def test_home_accessory(hass, hk_driver):
with patch('homeassistant.components.homekit.accessories.'
'HomeAccessory.update_state') as mock_update_state:
await hass.async_add_job(acc.run)
await hass.async_block_till_done()
state = hass.states.get(entity_id)
mock_update_state.assert_called_with(state)

View file

@ -35,6 +35,7 @@ async def test_default_thermostat(hass, hk_driver, cls):
await hass.async_block_till_done()
acc = cls.thermostat(hass, hk_driver, 'Climate', entity_id, 2, None)
await hass.async_add_job(acc.run)
await hass.async_block_till_done()
assert acc.aid == 2
assert acc.category == 9 # Thermostat
@ -175,6 +176,7 @@ async def test_auto_thermostat(hass, hk_driver, cls):
await hass.async_block_till_done()
acc = cls.thermostat(hass, hk_driver, 'Climate', entity_id, 2, None)
await hass.async_add_job(acc.run)
await hass.async_block_till_done()
assert acc.char_cooling_thresh_temp.value == 23.0
assert acc.char_heating_thresh_temp.value == 19.0
@ -254,6 +256,7 @@ async def test_power_state(hass, hk_driver, cls):
await hass.async_block_till_done()
acc = cls.thermostat(hass, hk_driver, 'Climate', entity_id, 2, None)
await hass.async_add_job(acc.run)
await hass.async_block_till_done()
assert acc.support_power_state is True
assert acc.char_current_heat_cool.value == 1
@ -306,6 +309,7 @@ async def test_thermostat_fahrenheit(hass, hk_driver, cls):
await hass.async_block_till_done()
acc = cls.thermostat(hass, hk_driver, 'Climate', entity_id, 2, None)
await hass.async_add_job(acc.run)
await hass.async_block_till_done()
hass.states.async_set(entity_id, STATE_AUTO,
{ATTR_OPERATION_MODE: STATE_AUTO,