RFC: Use bind_hass for helpers (#9745)

* Add Helpers bind_hass functionality

* Update other helpers
This commit is contained in:
Paulus Schoutsen 2017-10-08 08:17:54 -07:00 committed by GitHub
parent e19e9a1f2b
commit ca54bbfcc9
16 changed files with 108 additions and 25 deletions

View file

@ -84,3 +84,22 @@ def test_component_wrapper(hass):
yield from hass.async_block_till_done()
assert len(calls) == 1
@asyncio.coroutine
def test_helpers_wrapper(hass):
"""Test helpers wrapper."""
helpers = loader.Helpers(hass)
result = []
def discovery_callback(service, discovered):
"""Handle discovery callback."""
result.append(discovered)
helpers.discovery.async_listen('service_name', discovery_callback)
yield from helpers.discovery.async_discover('service_name', 'hello')
yield from hass.async_block_till_done()
assert result == ['hello']