Pass hass_config to load_platform (#17952)
* Pass hass_config to load_platform * Fix tests * Lint
This commit is contained in:
1 parent
04e0fd1d46
commit
3a8891d9ac
21 files changed
+70
-57
No files matched your search
@@ -180,7 +180,7 @@ class TestComponentsDeviceTracker(unittest.TestCase):
|
||||
assert device_tracker.DOMAIN not in self.hass.config.components
|
||||
discovery.load_platform(
|
||||
self.hass, device_tracker.DOMAIN, 'demo', {'test_key': 'test_val'},
|
||||
{})
|
||||
{'demo': {}})
|
||||
self.hass.block_till_done()
|
||||
assert device_tracker.DOMAIN in self.hass.config.components
|
||||
assert mock_demo_setup_scanner.called
|
||||
|
||||
@@ -674,7 +674,7 @@ class TestLightMQTTJSON(unittest.TestCase):
|
||||
|
||||
async def test_discovery_removal(hass, mqtt_mock, caplog):
|
||||
"""Test removal of discovered mqtt_json lights."""
|
||||
await async_start(hass, 'homeassistant', {})
|
||||
await async_start(hass, 'homeassistant', {'mqtt': {}})
|
||||
data = (
|
||||
'{ "name": "Beer",'
|
||||
' "platform": "mqtt_json",'
|
||||
|
||||
@@ -180,7 +180,7 @@ class TestLockMQTT(unittest.TestCase):
|
||||
|
||||
async def test_discovery_removal_lock(hass, mqtt_mock, caplog):
|
||||
"""Test removal of discovered lock."""
|
||||
await async_start(hass, 'homeassistant', {})
|
||||
await async_start(hass, 'homeassistant', {'mqtt': {}})
|
||||
data = (
|
||||
'{ "name": "Beer",'
|
||||
' "command_topic": "test_topic" }'
|
||||
|
||||
@@ -66,7 +66,8 @@ class TestNotifyDemo(unittest.TestCase):
|
||||
"""Test discovery of notify demo platform."""
|
||||
assert notify.DOMAIN not in self.hass.config.components
|
||||
discovery.load_platform(
|
||||
self.hass, 'notify', 'demo', {'test_key': 'test_val'}, {})
|
||||
self.hass, 'notify', 'demo', {'test_key': 'test_val'},
|
||||
{'notify': {}})
|
||||
self.hass.block_till_done()
|
||||
assert notify.DOMAIN in self.hass.config.components
|
||||
assert mock_demo_get_service.called
|
||||
|
||||
@@ -85,8 +85,8 @@ class TestGoogle(unittest.TestCase):
|
||||
|
||||
calendar_service = google.GoogleCalendarService(
|
||||
self.hass.config.path(google.TOKEN_FILE))
|
||||
self.assertTrue(google.setup_services(self.hass, True,
|
||||
calendar_service))
|
||||
assert google.setup_services(
|
||||
self.hass, {'google': {}}, True, calendar_service)
|
||||
# self.hass.services.call('google', 'found_calendar', calendar,
|
||||
# blocking=True)
|
||||
|
||||
|
||||
@@ -79,15 +79,15 @@ class TestHelpersDiscovery:
|
||||
platform_callback)
|
||||
|
||||
discovery.load_platform(self.hass, 'test_component', 'test_platform',
|
||||
'discovery info')
|
||||
'discovery info', {'test_component': {}})
|
||||
self.hass.block_till_done()
|
||||
assert mock_setup_component.called
|
||||
assert mock_setup_component.call_args[0] == \
|
||||
(self.hass, 'test_component', None)
|
||||
(self.hass, 'test_component', {'test_component': {}})
|
||||
self.hass.block_till_done()
|
||||
|
||||
discovery.load_platform(self.hass, 'test_component_2', 'test_platform',
|
||||
'discovery info')
|
||||
'discovery info', {'test_component': {}})
|
||||
self.hass.block_till_done()
|
||||
|
||||
assert len(calls) == 1
|
||||
@@ -202,7 +202,8 @@ class TestHelpersDiscovery:
|
||||
async def test_load_platform_forbids_config():
|
||||
"""Test you cannot setup config component with load_platform."""
|
||||
with pytest.raises(HomeAssistantError):
|
||||
await discovery.async_load_platform(None, 'config', 'zwave')
|
||||
await discovery.async_load_platform(None, 'config', 'zwave', {},
|
||||
{'config': {}})
|
||||
|
||||
|
||||
async def test_discover_forbids_config():
|
||||
|
||||
@@ -131,7 +131,7 @@ class TestHelpersEntityComponent(unittest.TestCase):
|
||||
component.setup({})
|
||||
|
||||
discovery.load_platform(self.hass, DOMAIN, 'platform_test',
|
||||
{'msg': 'discovery_info'})
|
||||
{'msg': 'discovery_info'}, {DOMAIN: {}})
|
||||
|
||||
self.hass.block_till_done()
|
||||
|
||||
|
||||
Reference in new issue
Block a user