RFC: Use bind_hass for helpers (#9745)
* Add Helpers bind_hass functionality * Update other helpers
This commit is contained in:
1 parent
e19e9a1f2b
commit
ca54bbfcc9
16 files changed
+108
-25
No files matched your search
@@ -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']
|
||||
Reference in new issue
Block a user